home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-27 | 214.7 KB | 11,053 lines |
-
- ****************************************************
- ********* ZSHELL (C) 1990,91 Paul Hayter *********
- ******** updated to V2.3 by Martin Gierich ********
- ******** First major change: 08.06.93 ********
- ********* Last change: 26.02.95 *********
- ****************************************************
-
- **ZShell V2.4.1, Changes since V2.3:
- *Bugfix: "run -c","delete device",Prompt-Farbe,"Assign" unter OS1.3
- *Setzt Wildstar-Flag
- *AppWindow/AppIcon zur File/Dirnameneingabe
- *MEMCLK,BORDER benutzt richtiges Fenster, nicht aktuelles
- *>m erhaelt review-buffer
- *Fehlerausgabe immer auf Konsole
- *Debug-Flag fuer Scripts und Aliases
- *ASK,MORE: Input von stdin statt inhandle
- *SHOW TASK zeigt bgCLI/CLI und Redir
- *Erroroutput during starting
- *noraw input abbruch
- *COPY: dots als Progressindicator
- *Eingabe von Sonderzeichen
- *Zeigt LowMem-Changes und Lock-Changes
- *Result2 zeigt richtiger Wert
- *List-Sort gibt auch bei Break Speicher frei
- *Welcome-Text
- *cli_CommandName/File
- *Hide-Flag
- *DIE killt Handler und Tasks
-
- ;DEBUG = 1
-
- *** TABSIZE = 8 Chars ***
- *** Local Labels named .A to .Z ***
-
- VERSION equ $1234
-
- FLcheck =0
- FLmatch =1
- FLappicon =2
- FLwild =3
- FLerrors =4
- FLdebug =5
- FLcutline =6
- FLall =7
- FLhide =8
- MaxFlags =9
-
- FIB equ 260 ;FileInfoBlock
- ACCESS_READ equ -2
- ACCESS_WRITE equ -1
- MODE_READWRITE equ 1004
- MODE_OLDFILE equ 1005
- MODE_NEWFILE equ 1006
-
- SIGBREAKB_CTRL_C equ $C
- SIGBREAKB_CTRL_D equ $D
- SIGBREAKB_CTRL_E equ $E
- SIGBREAKB_CTRL_F equ $F
-
- eb_CoolCapture equ 46
- eb_ColdCapture equ 42
- eb_WarmCapture equ 50
- eb_KickMemPtr equ 546
- eb_KickTagPtr equ 550
- eb_KickCheckSum equ 554
-
- * FILE INFO BLOCK
- fib_DiskKey equ $0000
- fib_DirEntryType equ $0004
- fib_FileName equ $0008
- fib_Protection equ $0074
- fib_EntryType equ $0078
- fib_Size equ $007c
- fib_NumBlocks equ $0080
- fib_Date equ $0084
- fib_Comment equ $0090
- fib_Reserved equ $00e0
-
- * INFO DATA STRUCTURE
- id_NumSoftErrors equ 0
- id_UnitNumber equ 4
- id_DiskState equ 8
- id_NumBlocks equ 12
- id_NumBlocksUsed equ 16
- id_BytesPerBlock equ 20
- id_DiskType equ 24
- id_VolumeNode equ 28
- id_InUse equ 32
-
- * TASK
- tc_State equ 15
- tc_SigWait equ 22
-
- * PROCESS
-
- pr_MsgPort equ 92
- pr_SegList equ 128
- pr_StackSize equ 132
- pr_GlobVec equ 136
- pr_TaskNum equ 140
- pr_StackBase equ 144
- pr_Result2 equ 148
- pr_CurrentDir equ 152
- pr_CIS equ 156
- pr_COS equ 160
- pr_ConsoleTask equ 164
- pr_FileSystemTask equ 168
- pr_CLI equ 172
- pr_ReturnAddr equ 176
- pr_PktWait equ 180
- pr_WindowPtr equ 184
- pr_HomeDir equ 188 KS2
- pr_Flags equ 192
- pr_CES equ 224
-
- * COMMAND LINE INTERFACE
- cli_Result equ 0
- cli_SetName equ 4
- cli_CommandDir equ 8
- cli_ReturnCode equ 12
- cli_CommandName equ 16
- cli_FailLevel equ 20
- cli_Prompt equ 24
- cli_StandardInput equ 28
- cli_CurrentInput equ 32
- cli_CommandFile equ 36
- cli_Interactive equ 40
- cli_Background equ 44
- cli_CurrentOutput equ 48
- cli_DefaultStack equ 52
- cli_StandardOutput equ 56
- cli_Module equ 60
-
- * FILE HANDLE
- fh_Link equ 0
- fh_Port equ 4
- fh_Type equ 8
- fh_Buf equ 12
- fh_Pos equ 16
- fh_End equ 20
-
- * FILE LOCK
- fl_Link equ 0
- fl_Key equ 4
- fl_Access equ 8
- fl_Task equ 12
- fl_Volume equ 16
-
- * DATESTAMP
- ds_Days equ 0
- ds_Minute equ 4
- ds_Tick equ 8
-
- RETURN_OK EQU 0
- RETURN_WARN EQU 5
- RETURN_ERROR EQU 10
- RETURN_BAD EQU 15
- RETURN_FAIL EQU 20
-
- *Assign Stuff
- dl_Root equ 34 APTR
- rn_Info equ 24 BPTR
- rn_Flags equ 52 LONG
- di_DevInfo equ 4 BPTR
- di_NetHand equ 16 BPTR
- dvi_Next equ 0 BPTR
- dvi_Type equ 4 LONG
- dvi_Task equ 8 APTR
- dvi_Lock equ 12 BPTR
- dvi_Handler equ 16 (PathPtr)
- dvi_StackSize equ 20
- dvi_LockList equ 20
- dvi_Priority equ 24
- dvi_Startup equ 28
- dvi_SegList equ 32
- dvi_GlobVec equ 36
- dvi_Name equ 40 BSTR
- dlt_device equ 0 <-- contents of dvi_Type
- dlt_directory equ 1
- dlt_volume equ 2
- dlt_late equ 3
- dlt_nonbind equ 4
-
- *Resident Stuff
- resi_link equ 0 ;BPTR
- resi_usecount equ 4 ;LONG
- resi_seglist equ 8 ;BPTR
- resi_name equ 12 ;BSTR
- resi_length equ 4+4+4
-
- *Icon Lib Stuff
- sm_Process equ $14
- sm_Segment equ $18
- sm_NumArgs equ $1c
- sm_ToolWindow equ $20
- sm_ArgList equ $24
- wa_Lock equ 0
- wa_Name equ 4
- do_Magic equ 0 ;must be $e310
- do_Type equ $30
- do_ToolTypes equ $36
- do_ToolWindow equ $46
- do_StackSize equ $4a
-
- *WAppMessage
- am_Type equ 20
- am_NumArgs equ 30
- am_ArgList equ 34
-
- * AVAIL STUFF
- MEMF_PUBLIC equ 1
- MEMF_CHIP equ 2
- MEMF_FAST equ 4
- MEMF_CLEAR equ $10000
- MEMF_LARGEST equ $20000
-
- * ACTIONS
- ACTION_SCREEN_MODE EQU 994
- ACTION_INHIBIT EQU 31
- ACTION_MORE_CACHE EQU 18
- ACTION_RENAME_DISK EQU 9
- ACTION_DIE EQU 5
- ACTION_DISK_CHANGE EQU 33
- ACTION_SET_DATE EQU 34
- ACTION_DISK_INFO EQU 25
- ACTION_WRITE_PROTECT EQU 1023
- ACTION_FLUSH EQU 27
- ACTION_READ EQU "R"
- ACTION_WRITE EQU "W"
-
- dp_Link EQU $00 ;DosPacket Structure
- dp_Port EQU $04
- dp_Type EQU $08
- dp_Arg1 EQU $14
- dp_SIZEOF EQU $30
-
- sp_Msg EQU $00 ;StandardPacket Structure
- sp_Pkt EQU $14
- sp_SIZEOF EQU $44
-
- LH_HEAD equ 0
- LH_TAIL equ 4
- LH_TAILPRED equ 8
- LH_TYPE equ 12
- LH_PAD equ 13
- LH_SIZE equ 14
-
- LN_SUCC equ 0
- LN_PRED equ 4
- LN_TYPE equ 8
- LN_PRI equ 9
- LN_NAME equ 10
- LN_SIZE equ 14
-
- NT_MSGPORT EQU 4
-
- MP_FLAGS EQU $0E ;Message Port Structure
- MP_SIGBIT EQU $0F ;Signal bit number
- MP_SIGTASK EQU $10 ;Task to be signalled
- MP_MSGLIST EQU $14 ;Message linked list
- MP_SIZE EQU $22
-
- mn_ReplyPort equ 14
- mn_Length equ 18
- mn_Size equ 20
-
- PA_SIGNAL EQU 0 ;PutAction messages
-
-
- * LIBRARY CALLS
- * EXEC
- _LVOOpenLibrary equ -552
- _LVOOldOpenLibrary equ -408
- _LVOCloseLibrary equ -414
- _LVOSetFunction equ -420
- _LVOAllocMem equ -198
- _LVOFreeMem equ -210
- _LVORawDoFmt equ -522
- _LVORawMayGetChar equ -510
- _LVOFindTask equ -294
- _LVOSetTaskPri equ -300
- _LVOAddTask equ -282
- _LVORemTask equ -288
- _LVOForbid equ -132
- _LVOPermit equ -138
- _LVOAvailMem equ -216
- _LVOAddPort equ -354
- _LVORemPort equ -360
- _LVOFindPort equ -390
- _LVOPutMsg equ -366
- _LVOGetMsg equ -372
- _LVOReplyMsg equ -378
- _LVOWaitPort equ -384
- _LVOWait equ -318
- _LVOSignal equ -324
- _LVOSetSignal equ -306
- _LVOAllocSignal equ -330
- _LVOFreeSignal equ -336
- _LVOOpenDev equ -444
- _LVOCloseDev equ -450
- _LVODoIO equ -456
- _LVOCreateMsgPort equ -666 KS 2.0+
- _LVODeleteMsgPort equ -672
-
- * DOS
- _LVOSetProtection equ -186
- _LVOOutput equ -60
- _LVOWrite equ -48
- _LVOLock equ -84
- _LVOUnLock equ -90
- _LVODupLock equ -96
- _LVOExamine equ -102
- _LVOExNext equ -108
- _LVOOpen equ -30
- _LVOClose equ -36
- _LVORead equ -42
- _LVOInput equ -54
- _LVODeleteFile equ -72
- _LVORename equ -78
- _LVOCreateDir equ -120
- _LVOCurrentDir equ -126
- _LVOIoErr equ -132
- _LVOParentDir equ -210
- _LVOLoadSeg equ -150
- _LVOUnLoadSeg equ -156
- _LVOCreateProc equ -138
- _LVOInfo equ -114
- _LVODateStamp equ -192
- _LVOSeek equ -66
- _LVODeviceProc equ -174
- _LVODelay equ -198
- _LVOSetComment equ -180
- _LVOIsInteractive equ -216
- _LVOReadLink equ -438 KS 2.0+
- _LVOMakeLink equ -444
- _LVOFault equ -468
- _LVOPrintFault equ -474
- _LVOAssignLock equ -612
- _LVOAssignLate equ -618
- _LVOAssignPath equ -624
- _LVOAssignAdd equ -630
- _LVORemAssignList equ -636
- _LVOFormat equ -714
- _LVOAddBuffers equ -732
- _LVOFilePart equ -870
- _LVOPathPart equ -876
- _LVOInhibit equ -726
- _LVOParsePatternNC equ -966
- _LVOMatchPatternNC equ -972
- _LVONameFromLock equ -402
-
- *Intuition
- _LVOPrintIText equ -216
- _LVODisplayAlert equ -90
- _LVODisplayBeep equ -96
- _LVOLockIBase equ -414
- _LVOUnlockIBase equ -420
- _LVORefreshWindowFrame equ -456
- _LVOSizeWindow equ -288
- _LVOMoveWindow equ -168
- _LVOActivateWindow equ -450
- _LVORemakeDisplay equ -384
- _LVOMakeScreen equ -378
- _LVORethinkDisplay equ -390
-
- *Icon
- _LVOGetDiskObject equ -78
- _LVOGetDefDiskObject equ -120
- _LVOPutDiskObject equ -84
- _LVOFreeDiskObject equ -90
- _LVOFindToolType equ -96
- _LVOMatchToolValue equ -102
-
- *Workbench
- _LVOAddAppIconA equ -60
- _LVOAddAppWindowA equ -48
- _LVORemoveAppIcon equ -66
- _LVORemoveAppWindow equ -54
- _LVOWBInfo equ -90
-
-
- * DOS LIBRARY
- dl_A2 equ 42
-
- *SYSTEM0 stuff!!!!!!!!!!
- REG_SysBase equr a6
-
- callsys macro
- jsr _LVO\1(REG_SysBase)
- endm
-
- * parameter offsets & stack
- ;SAVED_REGS reg a2-a6/d2-d3
- DELTA equ 7*4
- ARG_NAME equ 4+DELTA
- ARG_SEGLIST equ 8+DELTA
- ARG_ARGS equ 12+DELTA
-
- * additional return codes
- NO_CLI equ -1
- NO_MEM equ -2
-
- * local constants
- MAXBSTR equ 255
- LF equ 10
-
- * register usage
- REG_Result equr d3
- REG_Process equr a2 ;may not be A4, see below!
- REG_CLI equr a3
- REG_CIS equr a4 ;may not be A3, see below!
- REG_PrevStack equr a1 ;V2.0 changed from a5 to a1
-
- * local stack frame
- * STRUCTURE StackFrame,0
- RSRESET
- sf_CommandName RS.B MAXBSTR+1 ;BSTR, length byte!
- sf_CommandArgs RS.B MAXBSTR+1 ;not a BSTR, LF-terminated!
- sf_PrevStack RS.L 1
- sf_SaveReturnAddr RS.L 1
- sf_SaveModule RS.L 1
- sf_SaveCommandName RS.L 1
- sf_StackBase RS.L 1
- sf_StackSize RS.L 1
- sf_PushSize RS.L 1
- sf_Process RS.L 1
- sf_CLI RS.L 1
- sf_CIS RS.L 1
- sf_SCB_Buf RS.L 1
- sf_SCB_Pos RS.L 1
- sf_SCB_End RS.L 1
- sf_Membase RS.L 1
- sf_SIZEOF RS.W 0
-
- *Constants (only LONGS!)
- SHELLINE_SIZE equ 256 V1.30
- CLIBUF_SIZE equ 256
- NEWPRINTSIZE equ 200
- HISTORY_SIZE equ 1024 MUST BE POWER OF 2
-
- * THE GENERAL MEMORY BLOCK (LONGS!)
- RSRESET
- blockbase RS.B 260 the fib or info goes here
- sp_node RS.B 14 DOSpacket
- sp_reply RS.L 1
- sp_length RS.W 1
- sp_link RS.L 1
- sp_port RS.L 1
- packettype RS.L 1
- sp_res1 RS.L 1
- sp_res2 RS.L 1
- myArg1 RS.L 1
- myArg2 RS.L 1
- myArg3 RS.L 1
- myArg4 RS.L 1
- myArg5 RS.L 1
- myArg6 RS.L 1
- myArg7 RS.L 1
- packettask RS.L 1
- devproc RS.L 1 endofpacket
- unusedlock RS.L 1
- last_failcode RS.L 1
- outhandle RS.L 1
- inhandle RS.L 1
- unusedin RS.B 40
- unusedout RS.B 40
- stdout RS.L 1
- stdin RS.L 1
- EntryA0 RS.L 1
- better_Seglist RS.L 1
- parm1 RS.L 1 addr of each parameter within shelline
- parm2 RS.L 1
- parm3 RS.L 1
- parm4 RS.L 1
- parm5 RS.L 1
- parm6 RS.L 1
- parm7 RS.L 1
- parm8 RS.L 1
- parm9 RS.L 1
- parm10 RS.B 4*16 16 extra parms
- endofparms RS.L 1 for NULL end
-
- shelline RS.B SHELLINE_SIZE
- endofshelline
- CLIbuf RS.B CLIBUF_SIZE
- NewPrintBuffer RS.B NEWPRINTSIZE
- errorstack RS.L 1
- topstack RS.L 1
- stacksize RS.L 1
- temp1 RS.L 1
- temp2 RS.L 1
- temp3 RS.L 1
- temp4 RS.L 1
- tempbuf RS.B 2*SHELLINE_SIZE double shellinesizebuffer
- temp2buf RS.B 80 80 char temp buffer
- dosbase RS.L 1
- intuibase RS.L 1
- Result2 RS.L 1
- kickver RS.W 1
- old_prompt RS.L 1
- old_setname RS.L 1
- old_homedir RS.L 1
- Unused RS.W 1
- CLIptr RS.L 1
- Flags RS.L 1
- prompt_cr RS.L 1
- ConsoleSwitch RS.L 1
- count_line RS.L 1
- ignoreit RS.B 60 for filenamecompletition
- OldCTask RS.L 1
- OldCIS RS.L 1
- OldCOS RS.L 1
- bordersize RS.L 1
- scsize RS.L 1
- scaddr RS.L 1
- scptr RS.L 1
- scflag RS.B 1
- openwin_flag RS.B 1
- noresi_flag RS.B 1
- noreview_flag RS.B 1
- ReviewMem RS.L 1
- ReviewPtr RS.L 1
- ReviewSize RS.L 1
- unused_area RS.B 256
- now RS.L 1
- nost RS.L 1
- then RS.L 1
- past RS.B HISTORY_SIZE history buffer=1024 bytes
- thistask RS.L 1
- gather_ptr RS.L 1
- gather RS.B 40 CSI string=40 bytes
- tempbytes RS.W 1
- first_set_defn RS.L 1
- MPipePtr RS.L 1
- app_name RS.L 1
- wbbase RS.L 1
- closecdir RS.L 1
- temp5 RS.L 1
- temp6 RS.L 1
- temp7 RS.L 1
- appwinport RS.L 1
- appwindow RS.L 1
- unused_str RS.B 20 UNUSED !
- windowname RS.L 1
- mem_addr RS.L 1
- wild_flag RS.B 1
- unused_flag RS.B 1
- wild_string RS.B 80 allow 80 chars for wildcard
- date_mark RS.L 3 3 lwords
- mem_mark RS.L 3 3 lwords chip/fast/total
- CD_string RS.B 80 Allow 80 bytes.
- prompt_string RS.B 80 Allow 80 bytes.
- prompt_args RS.B 40 Allow 40 bytes
- line_count RS.W 1
- mult_comm_flag RS.W 1
- next_comm_ptr RS.L 1
- break_flag RS.B 1
- unused_level RS.B 3
- cd_block RS.L 1
- cd_volnode RS.L 1
- recurs_flag RS.W 1
- indent_count RS.W 1
- resi_flag RS.B 1
- forcediskflag RS.B 1
- CLIflag RS.B 1
- WBflag RS.B 1
- window_old RS.L 1
- wb_msg RS.L 1
- iconbase RS.L 1
- diskobj RS.L 1
- filesys_old RS.L 1
- cdir_old RS.L 1
- cdback RS.L 1
- ctrl_codes RS.B 16 Keyboard-CTRL-Codes
- if_flag RS.B 1
- if_condition RS.B 1
- goto_flag RS.B 1
- memclk_flag RS.B 1
- dest_label RS.B 60
- unused_me RS.L 1
- mem_offset_addr RS.L 1
- io_Message RS.B 20 io-request (timer)
- io_Device RS.L 1
- io_Unit RS.L 1
- io_Command RS.W 1
- io_Flags RS.B 1
- io_Error RS.B 1
- tv_secs RS.L 1
- tv_micro RS.L 1
- io_pad RS.L 2 ;don't remove
- sizeofblk RS.W 0
-
-
-
- ********************************************
-
- ; SECTION MYSHELL,CODE
-
- ;Try to open dos then do the shell
- start moveq #-1,d7
- move.l a0,a3
- move.l 4.w,a6
- move.l #sizeofblk,d0
- move.l #1+1<<16,d1 "memf_public" & clear it
- jsr _LVOAllocMem(a6) alloc general mem block
- tst.l d0
- beq blkfail
- move.l d0,a5 A5=MEMBASE
- move.l sp,topstack(a5)
- move.l a3,EntryA0(a5)
- move.w 20(a6),kickver(a5) Kickstart-Version
- lea intuiname(pc),a1
- jsr _LVOOldOpenLibrary(a6)
- tst.l d0
- beq intfail
- move.l d0,intuibase(a5)
- lea dosname(pc),a1
- jsr _LVOOldOpenLibrary(a6)
- tst.l d0
- beq dosfail
- move.l d0,dosbase(a5)
- clr.w CLIflag(a5) delete CLI&WBflag
- sub.l a1,a1
- jsr _LVOFindTask(a6)
- move.l d0,thistask(a5) save this task address
- move.l d0,a2
- move.l pr_CLI(a2),d0
- bne.s .A
- subq.w #1,CLIflag(a5) WB-Start
- lea pr_MsgPort(a2),a0
- IFND DEBUG
- jsr _LVOWaitPort(a6)
- ENDC
- lea pr_MsgPort(a2),a0
- jsr _LVOGetMsg(a6)
- move.l d0,wb_msg(a5)
- beq.s .C
- move.l d0,a0
- clr.l sm_Segment(a0) Clear Seg-Descriptor
- .C move.l pr_StackSize(a2),stacksize(a5)
- move.l pr_SegList(a2),d0
- beq.s .B
- lsl.l #2,d0
- move.l d0,a0
- clr.l 12(a0) Clear SegPointer
- bra.s .B
- .A lsl.l #2,d0 CLI-Start
- move.l d0,a2
- move.l cli_DefaultStack(a2),d0
- lsl.l #2,d0
- move.l d0,stacksize(a5) save stacksize
- clr.l cli_Module(a2) do not free seglist
- cmp.b #"r",1(a3)
- bne.s .B
- addq.b #1,noresi_flag(a5)
- .B move.l dosbase(a5),a6 A6=DOSBASE
- tst.b noresi_flag(a5)
- bne.s doIT
- lea ZShellName(pc),a4
- bsr search_res2
- lea start-4(pc),a1
- tst.l d0
- IFD DEBUG
- bra.s doIT
- ENDC
- beq.s cresi
- lsl.l #2,d0
- move.l d0,a2
- nop
- nop
- VCheck cmp.w #VERSION,VCheck-start+6(a2)
- bne normex
- addq.l #1,resi_usecount(a0)
- cmp.l a1,a2
- beq.s doIT running as resident
- jmp JumpIn-start+4(a2) Jump to JumpIn, but in the resident Code
- JumpIn move.l a1,d1 here it arrives
- lsr.l #2,d1
- jsr _LVOUnLoadSeg(a6) free old mem
- bra.s doIT
- cresi move.l a1,d3
- lsr.l #2,d3
- bsr create_resi make zshell resident
- bne crfail
- addq.l #1,resi_usecount(a2)
- doIT bsr shell *** DO IT ***
- bsr deallocate_sets
- bsr reviewend
- bsr KillAppWin
- bsr RemoveCLI
- lea start-4(pc),a0
- move.l a0,d6
- lsr.l #2,d6
- tst.b noresi_flag(a5)
- bne.s normex
- lea ZShellName(pc),a4
- bsr search_res2
- tst.l d0
- beq.s crfail
- subq.l #1,resi_usecount(a0)
- tst.l d7
- bne.s crfail
- moveq #1,d1
- cmp.l resi_usecount(a0),d1
- bne.s crfail
- move.l d0,d6 kill the ZShell-Resident
- move.l a0,a2
- move.l d2,a0
- move.l resi_link(a2),resi_link(a0)
- clr.l resi_link(a2)
- move.l a2,d1
- lsr.l #2,d1
- jsr _LVOUnLoadSeg(a6)
- normex bsr giveman free manualmem
- move.l thistask(a5),a0
- tst.b CLIflag(a5) How to UnLoad the Segment
- beq.s .A
- move.l pr_SegList(a0),d0
- beq.s .B
- lsl.l #2,d0
- move.l d0,a0
- move.l d6,12(a0) Store Segment in SegPointer (WB/RUN)
- .B move.l wb_msg(a5),d0
- beq.s crfail
- move.l d0,a0
- move.l d6,sm_Segment(a0) and in Seg-Descriptor (WB)
- bra.s crfail
- .A move.l pr_CLI(a0),a0
- add.l a0,a0
- add.l a0,a0
- move.l d6,cli_Module(a0) Store Segment in Module (CLI)
- crfail move.l dosbase(a5),a1
- move.l 4.w,a6
- jsr _LVOCloseLibrary(a6)
- dosfail move.l intuibase(a5),a1
- jsr _LVOCloseLibrary(a6)
- intfail move.l wb_msg(a5),d2
- move.l a5,a1
- move.l #sizeofblk,d0
- jsr _LVOFreeMem(a6)
- tst.l d2
- beq.s .A
- jsr _LVOForbid(a6) (what for ?)
- move.l d2,a1 WB-Message
- jmp _LVOReplyMsg(a6) never returns !
- .A moveq #0,d0
- rts
- blkfail moveq #RETURN_ERROR,d0
- rts
-
- initialise_default
- move.l CLIptr(a5),a0
- moveq #16,d0
- move.l d0,cli_FailLevel(a0)
- move.b #LF,past(a5)
- lea prompt_args_tx(pc),a0 init prompt
- lea prompt_args(a5),a1
- .C move.b (a0)+,(a1)+
- bne.s .C
- moveq #ctrl_inite-ctrl_init-1,d0
- lea ctrl_init(pc),a0
- lea ctrl_codes(a5),a1
- .B move.b (a0)+,(a1)+ init ctrl-codes
- dbra d0,.B
- rts
-
- InitAppWin
- tst.l ConsoleSwitch(a5) test noraw-mode
- beq.s .A
- move.l 4.w,a6
- jsr _LVOCreateMsgPort(a6) get msg-port
- move.l d0,appwinport(a5)
- beq.s .A
- move.l d0,a2
- move.l dosbase(a5),a6
- bsr GetWindowPtr get ptr to window
- move.l a0,d2
- beq.s .A
- bsr OpenWBLib
- beq .A
- moveq #0,d0
- moveq #0,d1
- move.l d2,a0
- sub.l a1,a1
- exg.l a1,a2
- jsr _LVOAddAppWindowA(a6) make appwin
- move.l d0,appwindow(a5)
- .A move.l dosbase(a5),a6
- rts
-
- GetWindowPtr ;pointer to Console-Window to a0 (0 for fail)
- move.l thistask(a5),a0
- move.l pr_ConsoleTask(a0),packettask(a5)
- bsr GetDiskInfo
- sub.l a0,a0
- tst.l sp_res1(a5)
- beq.s .A
- move.l id_VolumeNode(a5),a0 it is in here !
- .A rts
-
- KillAppWin
- move.l appwindow(a5),d2
- beq.s .B
- bsr OpenWBLib
- move.l d2,a0
- jsr _LVORemoveAppWindow(a6)
- .B move.l appwinport(a5),d0
- beq.s .A
- move.l d0,a0
- move.l 4.w,a6
- jsr _LVODeleteMsgPort(a6)
- .A move.l dosbase(a5),a6
- rts
-
- * PRINT DECIMAL print D0 as decimal
- print10 movem.l d0/a0-a1,-(sp)
- move.l d0,-(sp)
- move.l sp,a1
- lea format(pc),a0
- bsr new_print
- addq.l #4,sp
- movem.l (sp)+,d0/a0-a1
- rts
-
- * PRINT HEXADECIMAL address in D0
- printADR movem.l d0/a0-a1,-(sp)
- move.l d0,-(sp)
- move.l sp,a1
- lea formatADR(pc),a0
- bsr new_print
- addq.l #4,sp
- movem.l (sp)+,d0/a0-a1
- rts
-
- *PRINT STRING at a1 ;saves some of the important low registers
- pr_space lea space(pc),a1
- bra.s pr_string
- pr_tab lea tab(pc),a1
- bra.s pr_string
- pr_prompt lea prompt_string(a5),a1
- bra.s pr_string
- pr_lf lea lf(pc),a1
- pr_string movem.l d0-d3/a0-a3,-(sp) print String in a1
- move.l a1,d2
- moveq #-1,d3
- .A addq.l #1,d3
- tst.b (a1)+
- bne.s .A
- move.l outhandle(a5),d1
- beq.s .B
- jsr _LVOWrite(a6)
- .B movem.l (sp)+,d0-d3/a0-a3
- rts
-
- pr_error
- move.l outhandle(a5),d1
- move.l stdout(a5),outhandle(a5)
- bsr pr_string
- move.l d1,outhandle(a5)
- rts
-
- *CHECK WHETHER A SCRIPT NAME WAS TYPED ON ENTRY TO ZSHELL
- execscr move.l EntryA0(a5),d0
- move.l d0,parm1(a5)
- beq.s .C
- move.l d0,a0
- tst.b (a0)
- bne xz2 ;NB this is OK, xz2 will pop the return addr
- ;and jump to chorus
- rts
- .C moveq #-1,d1 handle DEFAULT SCRIPT FILE s:zstart
- bsr changeWindowPtr disable volume requesters
- lea defscript(pc),a2
- move.l a2,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq.s .B
- move.l d0,d1
- jsr _LVOUnLock(a6)
- move.l a2,a0
- moveq #0,d1
- bsr changeWindowPtr
- bra xz2
- .B moveq #0,d1
- bsr changeWindowPtr
- rts
-
- CheckForbid
- move.l 4.w,a0 Check for not closed
- moveq #-1,d0
- cmp.b 294(a0),d0 Disables or
- bne.s .A
- cmp.b 295(a0),d0 Forbids
- beq.s .B
- .A move.b d0,294(a0) and avoids crashes !
- move.b d0,295(a0)
- lea Forbidtx(pc),a1
- bsr pr_stringlf
- .B rts
-
- *********************************
- * MAIN BIT *
- *********************************
- shell move.l sp,errorstack(a5)
- lea appicontx(pc),a0
- move.l a0,app_name(a5)
- move.l #%111010010,Flags(a5)
- bsr CreateCLI
- bne cloga exit on error
- move.l thistask(a5),a3
- move.l pr_CLI(a3),a2
- add.l a2,a2
- add.l a2,a2
- move.l a2,CLIptr(a5)
- move.l cli_Prompt(a2),old_prompt(a5)
- lea prompt_args(a5),a0
- move.l a0,d0
- lsr.l #2,d0
- move.l d0,cli_Prompt(a2)
- move.l cli_SetName(a2),old_setname(a5)
- lea CD_string(a5),a0
- move.l a0,d0
- lsr.l #2,d0
- move.l d0,cli_SetName(a2)
- cmp.w #36,kickver(a5)
- blo.s .C
- move.l pr_HomeDir(a3),old_homedir(a5)
- clr.l pr_HomeDir(a3)
- move.l dl_Root(a6),a0
- bset #24,rn_Flags(a0) set wildstar flag
- bsr InitAppWin
- .C jsr _LVOOutput(a6) SAVE THE CONSOLE HANDLERS
- move.l d0,outhandle(a5)
- move.l d0,stdout(a5)
- jsr _LVOInput(a6)
- move.l d0,inhandle(a5)
- move.l d0,stdin(a5)
- move.l pr_CurrentDir(a3),d1
- jsr _LVODupLock(a6)
- move.l d0,cdback(a5)
- cmp.b #1,WBflag(a5)
- beq.s notini run/newcli
- bsr initialise_default
- notini lea pr_TaskNum(a3),a1
- lea welcome(pc),a0
- bsr new_print
- bsr eval_CD
- IFND DEBUG
- bsr execscr
- ENDC
- chorus bsr CheckForbid HERE BEGINS THE MAIN LOOP
- bsr close_redirection
- bsr raw_on MAKE SURE RAW MODE IS ON
- clr.b noreview_flag(a5)
- bsr compose_prompt
- bsr get_line
- clr.b break_flag(a5)
- move.l 4.w,a6
- moveq #0,d0 clear signals c&d
- moveq #0,d1
- bset #SIGBREAKB_CTRL_C,d1
- bset #SIGBREAKB_CTRL_D,d1
- jsr _LVOSetSignal(a6)
- move.l dosbase(a5),a6
- clr.b forcediskflag(a5)
- move.l parm1(a5),a0
- move.b (a0),d0
- cmp.b ctrl_codes+15(a5),d0
- bne.s .A
- addq.l #1,a0
- tst.b (a0)
- bne.s .B
- move.l cdback(a5),d1 dir back
- jsr _LVODupLock(a6)
- move.l d0,d1
- bsr chdir
- bra.s chorus
- .B move.l a0,parm1(a5)
- addq.b #1,forcediskflag(a5)
- bra notfound force disk-command
- .A cmp.b #"#",(a0) #-sign for ;#comment
- beq chorus
- move.l a0,d7 check for ? (help sign)
- tst.b 1(a0)
- bne.s .C
- cmp.b #"?",(a0)
- bne.s .C
- bsr help_man ? as command
- bra chorus
- .C lea comtext(pc),a1
- lea comoffs(pc),a2
- mtch bsr match
- tst.l d0
- beq.s notfound
- move.l parm1(a5),d7 check for ? (help sign)
- move.l parm2(a5),a1
- tst.b 1(a1)
- bne.s .D
- cmp.b #"?",(a1)
- bne.s .D
- bsr rawh_off
- bsr help_man ? as arg
- bra chorus
- .D move.l sp,errorstack(a5) important in scripts ?
- lea start(pc),a0
- intern jsr 0(a0,d0.w) call internal command
- tst.b break_flag(a5)
- bne.s com_break
- chkfail move.l d0,last_failcode(a5)
- move.l CLIptr(a5),a0
- cmp.l cli_FailLevel(a0),d0 ALL COMMANDS MUST RETURN D0=0 unless failure
- blo chorus
- com_fail move.l d0,-(sp)
- move.l sp,a1
- lea failertx(pc),a0
- bsr new_print
- move.l (sp)+,d0
- com_break clr.b mult_comm_flag(a5)
- tst.b scflag(a5)
- beq chorus
- bsr kill_script
- bra chorus
- notfound bsr archie3 TRY DISK
- move.l d0,-(sp)
- move.l thistask(a5),a0
- move.l cd_volnode(a5),d0
- move.l pr_CurrentDir(a0),a1
- add.l a1,a1
- add.l a1,a1
- cmp.l fl_Volume(a1),d0 check volume node
- bne.s .A
- move.l cd_block(a5),d0
- cmp.l fl_Key(a1),d0 check disk block number
- beq.s .B
- .A bsr eval_CD If command changes cd then change prompt.
- .B move.l (sp)+,d0
- bra.s chkfail
-
-
- *Match the string pointed to by A0 to one in a table pted to by a1
- *The number of the matched string is linked to an offset table pted to by
- *A2. return with
- *D0 holding offset from 'start' so a jsr 0(a0,d0.w) can be done
- *Entry A1 pts to Command text table A2 pts to command offset table
-
- match moveq #0,d1 ;command count
- move.l a0,a3 ;save command
- mat2 move.b (a0)+,d0
- cmp.b ctrl_codes+15(a5),d0 ;check "."
- bne.s .A
- tst.b (a0)
- beq.s foundit ;shortcut
- .A cmp.b (a1),d0 ;V1.01
- beq.s mat3
- add.b #$20,d0 ;'A' -> 'a' handle commands typed in UCase
- cmp.b (a1),d0
- bne.s nextcom ;if any character wrong then check next
- mat3 addq.l #1,a1
- tst.b -1(a0) ;check whether 0 was last compared
- beq.s foundit ;if it was then success
- bra.s mat2
- nextcom tst.b (a1)+
- bne.s nextcom
- addq.l #2,d1 ;each offset is a word
- move.l a3,a0
- tst.b (a1) ;put 0,0 at end of com table
- bne.s mat2
- moveq #0,d0 ;D0 = 0 if command not found
- rts
- foundit move.w 0(a2,d1.l),d0 ;get offset
- rts
-
-
- * Subroutine for complet, limiting chars:":","/","""," " *
- cjk1 cmp.b #":",-1(a1)
- beq.s cjke
- cmp.b #"/",-1(a1)
- beq.s cjke
- cjk2 cmp.b #$22,-1(a1)
- beq.s cjke
- cmp.b #" ",-1(a1)
- cjke rts
-
- * Complete Filename in Shelline *
- * a2 points to part of filename, d6 length of part *
- * d4: linmax , d5:linhere *
- complet clr.b temp2buf(a5)
- lea shelline(a5),a1
- move.l a1,a0
- move.l d5,d6
- beq.s .B
- add.l d5,a1
- bsr cjk1
- beq.s .B ;.C
- .A subq.l #1,a1 look for begin of filename
- cmp.l a1,a0
- beq.s .B
- bsr cjk1
- bne.s .A
- .B move.l a1,a2 filename-pos. in a2
- sub.l a0,a1
- sub.l a1,d6 length in d6
- move.b (a2),d3 save char
- clr.b (a2) null-end pathname
- move.l a2,a1
- bra.s .F
- .D subq.l #1,a1 look for begin of path
- .F cmp.l a1,a0
- beq.s .E
- bsr cjk2
- bne.s .D
- .E move.l a1,d1
- moveq #-2,d2
- jsr _LVOLock(a6) lock path
- move.b d3,(a2) replace null-char by old one
- move.l d0,d7 save lock
- beq.s .C
- bsr fibexam2
- moveq #0,d3
- tst.l fib_DirEntryType(a5)
- bpl.s wdhcpl if plus,is directory
- .G move.l d7,d1
- jsr _LVOUnLock(a6)
- .C rts an error occured
- wdhcpl bsr fibexnx repeat to search whole dir
- tst.l d0 next filename or dirname
- beq endcpl
- lea fib_FileName(a5),a0
- move.l a0,a3
- lea ignoreit(a5),a1
- tst.b (a1)
- beq.s .F
- bsr wildmatch wildcheck
- tst.b d0
- beq.s wdhcpl
- .F move.l a3,a0
- move.l a2,a1
- move.l d6,d2
- bra.s .I
- .A move.b (a0)+,d0
- move.b (a1)+,d1
- bsr compD1D0nocase does it fit ?
- bne.s wdhcpl
- .I dbra d2,.A
- lea temp2buf(a5),a0
- tst.l d3
- bne.s .B
- .C move.b (a3)+,(a0)+ ! first time: copy filename !
- bne.s .C
- move.b #" ",-1(a0) add a space at the end (files)
- clr.b (a0)
- tst.l fib_DirEntryType(a5)
- bmi.s .E if plus,is directory
- move.b #"/",-1(a0) add a / at the end (dirs)
- .E moveq #1,d3
- bra.s wdhcpl
-
- .B btst #FLmatch,Flags+3(a5) ! next time !
- beq.s .G
- tst.l d3
- bmi.s .G
- moveq #-1,d3
- lea hide_cursor(pc),a1
- bsr pr_stringlf print first time
- lea temp2buf(a5),a1
- bsr pr_string
- bsr pr_space
- .G move.b (a0)+,d0
- move.b (a3)+,d1
- bsr compD1D0nocase next time: find longest common part
- bne.s .D
- tst.b -1(a0)
- beq.s .D
- tst.b -1(a3)
- bne.s .G
- .D clr.b -1(a0)
- btst #FLmatch,Flags+3(a5)
- beq wdhcpl
- lea fib_FileName(a5),a1
- lea tempbuf(a5),a0
- .J move.b (a1)+,(a0)+
- bne.s .J
- move.b #" ",-1(a0)
- tst.l fib_DirEntryType(a5)
- bmi.s .H if plus,is directory
- move.b #"/",-1(a0)
- .H move.b #" ",(a0)+
- clr.b (a0)
- lea tempbuf(a5),a1
- bsr pr_string print other times
- bra wdhcpl repeat with all filenames
-
- endcpl move.l d7,d1
- jsr _LVOUnLock(a6)
- btst #FLmatch,Flags+3(a5)
- beq .I
- tst.l d3 next time
- bpl.s .I
- lea show_cursor(pc),a1
- bsr pr_stringlf
- .I lea temp2buf(a5),a0
- moveq #-1,d3
- .G addq.l #1,d3
- tst.b (a0)+
- bne.s .G
- subq.l #1,a0
- sub.l d6,d3 D3=length
- bmi.s DisplayBeep
- cmp.w #SHELLINE_SIZE-2,d4 make sure line is not too long
- bhi.s DisplayBeep
- lea shelline(a5),a1 ethel
- lea 1(a1,d4.w),a3 A3=linmax
- move.l a3,a2
- add.l d3,a2 A2=linmax+length
- lea 0(a1,d5.w),a1 linhere
- .A move.b -(a3),-(a2) insert chars into shelline
- cmp.l a3,a1
- bne.s .A
- move.l d3,d0
- add.l d6,d0
- bra.s .C
- .D move.b -(a0),-(a2) copy found filename
- .C dbra d0,.D
- add.l d3,d5
- add.l d3,d4
- bsr gimme3 print shelline
- move.l d4,d0
- sub.l d5,d0
- lea tempbuf(a5),a1
- move.l a1,a0
- bra.s .E
- .F move.w #$9b<<8+"D",(a0)+ left cursor
- .E dbra d0,.F
- clr.b (a0)
- bsr pr_string restore cursorpos
- .B rts
- DisplayBeep
- move.l intuibase(a5),a6
- suba.l a0,a0
- jsr _LVODisplayBeep(a6)
- move.l dosbase(a5),a6
- rts
-
-
- get_one_char
- bsr GetWindowPtr
- move.l a0,a3
- bsr clearArgs
- move.l inhandle(a5),myArg1(a5)
- lea tempbytes(a5),a0
- move.l a0,myArg2(a5)
- moveq #1,d0
- move.l d0,myArg3(a5)
- move.l thistask(a5),a0
- move.l pr_ConsoleTask(a0),packettask(a5)
- moveq #ACTION_READ,d0
- move.l d0,packettype(A5)
- bsr sendpacket2 read keyboard with packets
- moveq #0,d3
- move.l thistask(a5),a0
- move.b pr_MsgPort+MP_SIGBIT(a0),d1
- bset d1,d3 set wait bit for reading
- move.l appwinport(a5),d2
- beq.s .A
- move.l d2,a0
- move.b MP_SIGBIT(a0),d1
- bset d1,d3 set wait bit for appwindow
- .A move.l d3,d0
- jsr _LVOWait(a6) wait for anything
- tst.l d2
- beq.s .B
- move.l d2,a0
- jsr _LVOGetMsg(a6) try to get appwinmsg
- tst.l d0
- beq.s .B
- move.l d0,a2
- bsr ProcessApp look at it
- move.l a2,a1
- jsr _LVOReplyMsg(a6)
- move.l dosbase(a5),a6
- lea tempbuf(a5),a1
- bsr print_def write iconname to shelline
- move.l intuibase(a5),a6
- move.l a3,a0
- jsr _LVOActivateWindow(a6)
- .C move.l 4.w,a6
-
- .B move.l thistask(a5),a0
- lea pr_MsgPort(a0),a0
- jsr _LVOGetMsg(a6) try to get read-packet-reply
- move.l d0,d1
- beq.s .A
- move.l dosbase(a5),a6
- lea sp_node(a5),a0
- move.l #212,d0
- cmp.l d1,a0
- bne pr_galactic got wrong dospacket
- tst.l sp_res1(a5)
- bmi.s .D error occured
- beq.s .D
- move.b tempbytes(a5),d6
- rts
- .D moveq #20,d1
- bsr GuruIt
- bra cloga
-
- saveundo
- lea shelline(a5),a0
- lea CLIbuf(a5),a1
- move.l d4,d0
- bra.s .B
- .A move.b (a0)+,(a1)+
- .B dbra d0,.A
- clr.b (a1)
- rts
-
- * A1 pts to past, d0=nost
- gimme lea shelline(a5),a2
- move.l d0,nost(a5)
- cmp.l now(a5),d0
- bne.s .C
- moveq #-1,d4 reset linmax
- lea CLIbuf(a5),a0
- .D addq.l #1,d4
- move.b (a0)+,(a2)+ copy undo to shelline
- bne.s .D
- move.l d4,d5 linmax=linhere
- bra gimme3
-
- .C moveq #0,d5 linhere = 0
- .B addq.l #1,d0 copy to shelline
- and.l #HISTORY_SIZE-1,d0
- cmp.b #LF,0(a1,d0.l)
- beq.s .A
- move.b 0(a1,d0.l),0(a2,d5.l)
- addq.l #1,d5
- bra.s .B
- .A move.l d5,d4 linmax=linhere
- gimme3 lea shelline(a5),a2 Print input line newer
- lea delete_line(pc),a1
- bsr pr_string
- move.l prompt_cr(a5),a1
- bsr pr_string
- clr.b 0(a2,d4.l) clear last
- move.l a2,a1
- bra pr_string
-
-
- * READ TEXT LINE from keyboard or script into buffer pointed to by a0,
- * and clear last byte. NOTE A0 is essentially ignored, and shelline is the
- * assumed address. Return with a0 same, and d0=length of text read
- type_in tst.b scflag(a5) ;check whether we're doing a script
- bne scr_in
- type_in2
- move.l a0,-(sp)
- tst.l ConsoleSwitch(a5)
- bne.s .A
- move.l a0,a2 use console in cooked mode
- .C move.l a2,d2
- move.l inhandle(a5),d1
- beq cloga
- move.l #SHELLINE_SIZE,d3
- jsr _LVORead(a6)
- tst.l d0
- bmi cloga
- beq cloga
- clr.b 0(a2,d0.l)
- cmp.b #LF,-1(a2,d0.l)
- bne.s .C
- cmp.b #LF,(a2)
- bne.s .B
- bsr pr_prompt
- bra.s .C
- .B move.l (sp)+,a0
- rts
-
- .A clr.b CLIbuf(a5) (for undo)
- moveq #0,d5 D5=linhere use console in raw mode
- moveq #0,d4 D4=linmax
- next_ch bsr get_one_char
- cmp.b #$9b,d6
- bne not_csi
- clr.l gather_ptr(a5)
- fetch_csi bsr get_one_char
- lea gather(a5),a0
- move.l gather_ptr(a5),d0
- move.b d6,0(a0,d0.l) ;save byte from CSI sequence.
- addq.l #1,gather_ptr(a5)
- moveq #40,d1
- cmp.l d1,d0
- blo.s .A
- clr.l gather_ptr(a5)
- .A cmp.b #'@',d6
- blo.s fetch_csi ;keep gathering if char < @
- cmp.b #'~',d6
- bhi.s fetch_csi ;keep gathering if char > ~
-
- cmp.b #"|",d6 CHECK CLOSE GADGET
- bne.s not_cloga
- cloga2 btst #FLappicon,Flags+3(a5)
- beq.s cloga exit immediately
- tst.b openwin_flag(a5)
- beq.s cloga
- bsr WaitAppIcon
- addq.b #1,noreview_flag(a5)
- bsr raw_on
- bsr gimme3
- move.l d4,d5
- bra next_ch
- cloga move.l dosbase(a5),a6 totally-exit-routine
- move.l errorstack(a5),sp ;kill return address on stack
- bsr raw_off
- moveq #-1,d7
- tst.b scflag(a5)
- beq.s .A
- bsr kill_script
- .A rts
-
- not_cloga
- cmp.b #'D',d6 CHECK LEFT ARROW <CSI>D
- bne.s not_left
- tst.l d5
- beq.s not_left
- subq.l #1,d5
- lea left_cursor(pc),a1
- bsr pr_string
- bra next_ch
-
- not_left cmp.b #'Z',d6 CHECK TAB & SHIFT <CSI> Z
- bne.s not_tab_left
- v_buffer
- tst.l ReviewSize(a5)
- beq next_ch
- movem.l d3-d7/a2-a4,-(sp)
- sub.l a3,a3
- bsr viewbuffer
- movem.l (sp)+,d3-d7/a2-a4
- addq.b #1,noreview_flag(a5)
- bsr gimme3
- move.l d4,d5
- bra next_ch
-
- not_tab_left cmp.b #'A',d6
- bne.s not_sh_left
- cmp.b #' ',gather(a5) CHECK SHIFT LEFT ARROW <CSI> A
- bne.s not_sh_left
- move.l d5,d0
- lea tempbuf(a5),a1
- move.l a1,a0
- bra.s .A
- .B move.w #$9b<<8+"D",(a0)+ left cursor
- .A dbra d0,.B
- clr.b (a0)
- bsr pr_string
- moveq #0,d5
- bra next_ch
-
- not_sh_left
- cmp.b #'C',d6 CHECK RIGHT ARROW <CSI>C
- bne.s not_right
- cmp.l d4,d5
- bhs.s not_right
- addq.l #1,d5
- lea right_cursor(pc),a1
- bsr pr_string
- bra next_ch
-
- not_right cmp.b #'@',d6
- bne.s not_sh_right
- cmp.b #' ',gather(a5) CHECK SHIFT RIGHT ARROW <CSI> @
- bne.s not_sh_right
- move.l d4,d0
- sub.l d5,d0
- lea tempbuf(a5),a1
- move.l a1,a0
- bra.s .A
- .B move.w #$9b<<8+"C",(a0)+ right cursor
- .A dbra d0,.B
- clr.b (a0)
- bsr pr_string
- move.l d4,d5
- bra next_ch
-
- not_sh_right
- cmp.b #'A',d6 CHECK UP ARROW
- bne.s not_up
- lea past(a5),a1
- move.l nost(a5),d0
- cmp.l then(a5),d0
- beq.s .B
- .A subq.l #1,d0
- and.l #HISTORY_SIZE-1,d0 WRAP AROUND
- cmp.b #LF,0(a1,d0.l)
- bne.s .A
- .B bsr gimme
- bra next_ch
-
- not_up cmp.b #'B',d6 CHECK DOWN ARROW
- bne.s not_down
- up_bit lea past(a5),a1 CALLED BY SHIFT DOWN BIT
- move.l nost(a5),d0
- cmp.l now(a5),d0
- beq.s .B
- .A addq.l #1,d0
- and.l #HISTORY_SIZE-1,d0
- cmp.b #LF,0(a1,d0.l)
- bne.s .A
- .B bsr gimme
- bra next_ch
-
- not_down cmp.b #'T',d6 CHECK SHIFT UP
- bne not_sh_up
- lea past(a5),a1
- tst.l d5
- bne.s search_his
- move.l then(a5),nost(a5) nost = then (the top)
- move.l nost(a5),d0
- bsr gimme
- bra next_ch
- search_his ;search shelline in history V2.0
- move.l nost(a5),d0
- .C cmp.l then(a5),d0
- bne.s .A
- move.l nost(a5),d0
- bra.s end_seh
- .A subq.l #1,d0
- and.l #HISTORY_SIZE-1,d0
- cmp.b #LF,0(a1,d0.l)
- bne.s .A
-
- lea shelline(a5),a0
- move.l d5,d1
- subq.l #1,d1
- move.l d0,d2
- .D addq.l #1,d2
- and.l #HISTORY_SIZE-1,d2
- movem.l d0/d1,-(sp)
- move.b 0(a1,d2.l),d0
- move.b (a0),d1
- bsr compD1D0nocase
- movem.l (sp)+,d0/d1
- bne.s .C
- addq.l #1,a0
- dbra d1,.D
- end_seh move.l d5,d1 save d5
- bsr gimme
- move.l d5,d0
- sub.l d1,d0
- bmi.s .C
- lea tempbuf(a5),a1
- move.l a1,a0
- bra.s .A
- .B move.w #$9b<<8+"D",(a0)+ left cursor
- .A dbra d0,.B
- clr.b (a0)
- bsr pr_string
- move.l d1,d5
- .C bra next_ch
-
-
- not_sh_up cmp.b #'S',d6 CHECK SHIFT DOWN
- bne.s not_sh_down
- move.l now(a5),nost(a5) nost = now (the bottom)
- bra up_bit
-
- not_sh_down ;NOTE V1.05
- cmp.b #'~',d6 CHECK FUNCTION KEYS AND HELP KEY
- bne next_ch
- cmp.b #'?',gather(a5)
- bne.s process_the_func_key
- lea help_ret(pc),a1
- move.l d0,-(sp) need crap on stack to call print_def
- bsr print_def will rip last 2 addrs off stack
- * never gets to this line
- process_the_func_key
- bsr translate_func_key
- bra next_ch
-
- * Was not a CSI code
- not_csi cmp.b ctrl_codes+6(a5),d6 CHECK ESCAPE (ctrl+[)
- beq cloga2 exit immediately
-
- not_esc cmp.b ctrl_codes+7(a5),d6 CHECK TAB (ctrl+I)
- bne.s not_tab_right
- .A cmp.l d4,d5
- bhs next_ch
- addq.l #1,d5
- lea right_cursor(pc),a1
- bsr pr_string
- lea shelline-1(a5),a0
- bsr tab_check
- bne.s .A
- bra next_ch
-
- not_tab_right
- cmp.b ctrl_codes+8(a5),d6 CHECK CTRL Y
- beq v_buffer same as shift&tab
-
- cmp.b ctrl_codes+9(a5),d6 CHECK BACKSPACE (ctrl+H)
- bne.s not_bs
- tst.l d5
- beq.s not_bs
- subq.l #1,d5
- lea backspace_it(pc),a1
- bsr pr_string
- bsr del_str
- bsr saveundo
- bra next_ch
-
- del_str lea shelline(a5),a4
- lea SHELLINE_SIZE+shelline(a5),a1 NOTE SHELLINE SIZE!!!
- lea 0(a4,d5.w),a0
- lea 1(a0),a2
- .A move.b (a2)+,(a0)+
- cmp.l a2,a1
- bne.s .A
- subq.l #1,d4
- rts
-
- not_bs cmp.b #$7f,d6 CHECK DELETE
- bne.s not_del
- cmp.l d4,d5
- bhs.s not_del
- lea delete_it(pc),a1
- bsr pr_string
- bsr del_str
- bsr saveundo
- bra next_ch
-
- not_del cmp.b ctrl_codes+5(a5),d6 CHECK CTRL X
- bne.s not_ctrlx
- bsr saveundo
- moveq #0,d5 delete shelline
- moveq #0,d4
- bsr gimme3
- bra next_ch
-
- not_ctrlx
- cmp.b ctrl_codes+3(a5),d6 CHECK CTRL E
- bne.s not_ctrle
- .A cmp.l d4,d5 delete to end of line
- bhs.s .B
- lea delete_it(pc),a1
- bsr pr_string
- bsr del_str
- bra.s .A
- .B bsr saveundo
- bra next_ch
-
- not_ctrle
- cmp.b ctrl_codes+2(a5),d6 CHECK CTRL S
- bne.s not_ctrls
- .A tst.l d5 delete to start of line
- beq.s .B
- subq.l #1,d5
- lea backspace_it(pc),a1
- bsr pr_string
- bsr del_str
- bra.s .A
- .B bsr saveundo
- bra next_ch
-
- not_ctrls
- cmp.b ctrl_codes+1(a5),d6 CHECK CTRL W
- bne.s not_ctrlw
- .A tst.l d5 delete last word
- beq next_ch
- subq.l #1,d5
- lea backspace_it(pc),a1
- bsr pr_string
- bsr del_str
- lea shelline-1(a5),a0
- bsr tab_check
- bne.s .A
- bsr saveundo
- bra next_ch
-
- not_ctrlw
- cmp.b ctrl_codes+0(a5),d6 CHECK CTRL Q
- bne.s not_ctrlq
- .A cmp.l d4,d5 delete next word
- bhs next_ch
- lea delete_it(pc),a1
- bsr pr_string
- bsr del_str
- lea shelline+0(a5),a0
- bsr tab_check
- bne.s .A
- bsr saveundo
- bra next_ch
-
- not_ctrlq
- cmp.b ctrl_codes+4(a5),d6 CHECK CTRL A
- bne.s not_ctrla
- movem.l d3/d6/d7/a3,-(sp)
- bsr complet complete filename
- movem.l (sp)+,d3/d6/d7/a3
- bsr saveundo
- bra next_ch
-
- not_ctrla
- cmp.b ctrl_codes+10(a5),d6 CHECK CTRL J
- bne.s not_ctrlj
- bsr do_cr2
- move.l errorstack(a5),sp
- bra chorus
-
- not_ctrlj
- cmp.b ctrl_codes+12(a5),d6 CHECK CTRL L
- bne.s not_ctrll
- lea clrtx(pc),a1
- bsr pr_string clear window
- bsr gimme3
- move.l d4,d5
- bra next_ch
-
- not_ctrll
- cmp.b ctrl_codes+13(a5),d6 CHECK CTRL R
- bne.s not_ctrlr
- tab_left tst.l d5
- beq next_ch
- subq.l #1,d5
- lea left_cursor(pc),a1
- bsr pr_string
- lea shelline-1(a5),a0
- bsr tab_check
- bne.s tab_left
- bra next_ch
-
- tab_check cmp.b #' ',(a0,d5.w) words are separated by / . : or space
- beq.s .A
- cmp.b #':',(a0,d5.w)
- beq.s .A
- cmp.b #'.',(a0,d5.w)
- beq.s .A
- cmp.b #'/',(a0,d5.w)
- .A rts
-
- not_ctrlr
- cmp.b ctrl_codes+14(a5),d6 CHECK CTRL V
- bne.s not_ctrlv
- movem.l d3-d7/a2-a4,-(sp)
- lea past(a5),a2
- move.l now(a5),d3
- move.l #HISTORY_SIZE,d2
- sub.l a3,a3
- bsr viewhist
- movem.l (sp)+,d3-d7/a2-a4
- addq.b #1,noreview_flag(a5)
- bsr gimme3
- move.l d4,d5
- bra next_ch
-
- not_ctrlv
- cmp.b ctrl_codes+11(a5),d6 CHECK CTRL M
- beq.s do_cr
- cmp.b #13,d6 CHECK CR
- bne no_cr
- do_cr move.l (sp)+,a2
- do_cr2 lea return_it(pc),a1
- bsr pr_string
- lea shelline(a5),a4
- move.b #LF,0(a4,d4.w) HACK JOB (MUST END IN LF 0)
- clr.b 1(a4,d4.w) FOR ALIAS STUFF
- tst.l d4 CHECK IF NOTHING TYPED
- bne.s history_it
- bsr pr_prompt IF JUST HIT RETURN, THEN START AGAIN
- move.l a2,a0
- bra type_in2
- history_it
- lea past(a5),a1 CHECK IF LAST ENTRY IS SAME AS CURRENT
- move.l now(a5),d0
- cmp.l then(a5),d0
- beq.s .B
- move.l d0,nost(a5)
- .A subq.l #1,d0 FIND LAST
- and.l #HISTORY_SIZE-1,d0 WRAP AROUND
- cmp.b #LF,0(a1,d0.l)
- bne.s .A
- lea (a4),a0
- bra.s .C
- .D cmp.b #LF,d1 COMPARE LAST TO SHELLINE
- beq finland
- .C addq.l #1,d0
- and.l #HISTORY_SIZE-1,d0
- move.b (a0)+,d1
- cmp.b 0(a1,d0.l),d1
- beq.s .D
-
- .B move.l a4,a3 lin COPY LINE TO HISTORY BUFFER
- move.l now(a5),d3 pts to the last LF
-
- .E addq.l #1,d3
- and.l #HISTORY_SIZE-1,d3 WRAP AROUND
- move.b (a3)+,d0
- move.b d0,0(a1,d3.l)
- cmp.b #LF,d0
- bne.s .E
- ;dumped_hist
- move.l d3,nost(a5) nost = now
- move.l d3,now(a5)
- move.l then(a5),d1
- cmp.b #LF,0(a1,d1.l)
- bne.s .G BRANCH IF WRAPPED AROUND
- cmp.l d3,d1
- bne.s finland BRANCH IF THEN = (10) & THEN <> NOW
- .G
- * move.l d3,then(a5) then=now
- .H addq.l #1,d3 SEARCH FOR NEXT LF (NEW TOP OF HISTORY)
- and.l #HISTORY_SIZE-1,d3 WRAP AROUND
- move.b 0(a1,d3.l),d0
- cmp.b #LF,d0
- bne.s .H ***
- move.l d3,then(a5) SET NEW THEN (TOP OF HISTORY)
-
- *******
- finland tst.b scflag(a5)
- bne.s .D
- lea prompt_string(a5),a1 write to review-buffer
- move.l a1,d2
- moveq #-1,d3
- .E addq.l #1,d3
- tst.b (a1)+
- bne.s .E
- bsr toreview
- move.l a2,d2
- move.l d4,d3
- addq.l #1,d3
- bsr toreview
- .D move.l a2,a0
- move.l d4,d0
- rts
-
- no_cr cmp.b #" ",d6
- blo.s .A
- cmp.b #127,d6
- bls.s .B
- cmp.b #160,d6
- blo.s .A
- .B bsr ins_char
- bsr saveundo
- .A bra next_ch
-
- * insert a char in the shelline
- ins_char cmp.w #SHELLINE_SIZE-2,d4 make sure line is not too long
- bhi.s .B
- lea tempbuf(a5),a1
- move.w #$9b<<8+"@",(a1)
- clr.b 3(a1)
- move.b d6,2(a1) shove printable char after insert seq
- bsr pr_string insert space for char
- lea shelline(a5),a1 ethel
- lea 1(a1,d4.w),a0 linmax
- lea 1(a0),a2 A2=linmax+1
- lea 0(a1,d5.w),a1 linhere
- .A move.b -(a0),-(a2) insert char into shelline
- cmp.l a0,a1
- bne.s .A
- lea shelline(a5),a4
- move.b d6,0(a4,d5.w)
- addq.l #1,d5
- addq.l #1,d4
- .B rts
-
- * TRANSLATE FUNC CODE TO F1,F2 ETC AND SET UP POINTERS
- translate_func_key
- lea gather(a5),a0
- move.l gather_ptr(a5),d0
- cmp.b #3,d0 CHECK IF TWO CODES EG '12'
- beq process_shift_func
- unshifted_func_key
- cmp.b #2,d0
- bne translate_func_fail
- move.b (A0),d0
- moveq #'f',d1
- act_sh bsr convert_to_set_name
- bsr search_sets returns D0 pointer to set
- bsr print_func_defn
- rts
- process_shift_func
- move.b 1(A0),d0
- moveq #'F',d1
- bra.s act_sh
- translate_func_fail
- rts
-
- *d0=set ptr
- print_func_defn
- tst.l d0
- beq do_not_print_func
- move.l d0,a1
- lea set_defn(a1),a1
- print_def lea shelline(a5),a2
- bra.s .B
- .A addq.l #1,d5 copy defn to shelline
- .B move.b (a1)+,0(a2,d5.l)
- bne.s .A
- cmp.b #'M',-1(a2,d5.l) check for auto return ^M
- bne.s .C
- cmp.b #'^',-2(a2,d5.l)
- bne.s .C
- subq.l #2,d5
- move.l d5,d4
- bsr gimme3 print it
- movem.l (sp)+,d0-d1 get rid of last 2 return addresses
- bra do_cr do a carriage return
-
- .C move.l d5,d4 linmax=linhere
- bra gimme3 show prompt,new line
- do_not_print_func
- rts
-
- convert_to_set_name
- lea temp2buf(a5),a1
- move.b d1,(a1)+
- addq.b #1,d0
- move.b d0,(a1)+
- cmp.b #':',d0
- bne not_func10
- move.b #'1',-1(a1)
- move.b #'0',(a1)+
- not_func10
- clr.b (a1)
- rts
-
- search_sets
- * uses temp2buf, EXIT: D0 ptr to the associated set. D1 pts to prior set
- * RETURN D0=0 IF NOT FOUND.
- movem.l d2-d4/a1-a2,-(sp)
- lea temp2buf(a5),a1
- move.l a1,d2
- lea first_set_defn(a5),a2
- move.l a2,d4 NOTE PRIOR SET
- move.l (a2),d3
- search_next_set
- beq .B
- move.l d3,a2
- lea set_name(a2),a2 A2=current set name
- move.l d2,a1 A1=name to match
- bra.s .C
- .A tst.b d0
- beq.s .B
- .C move.b (a1)+,d0
- move.b (a2)+,d1
- bsr compD1D0nocase
- beq.s .A
-
- move.l d3,a2
- move.l d3,d4
- move.l (a2),d3
- bra search_next_set
- .B move.l d3,d0
- move.l d4,d1
-
- movem.l (sp)+,d2-d4/a1-a2
- rts
-
-
- * DO SCRIPT FILE STUFF ENTRY A0 -> input line
- scr_in movem.l a0-a1/a6,-(sp)
- clr.b break_flag(a5)
- move.l 4.w,a6
- moveq #0,d0
- moveq #0,d1
- bset #SIGBREAKB_CTRL_D,d1
- jsr _LVOSetSignal(a6)
- movem.l (sp)+,a0-a1/a6
- btst #SIGBREAKB_CTRL_D,d0 ;checks if CTRL_D pressed
- beq.s .B
- lea breaktx(pc),a1
- bsr pr_string
- move.b #1,break_flag(a5)
- bra.s terminate_script
- .B move.l scsize(a5),d1 ;read a line from the script file
- add.l scaddr(a5),d1
- sub.l scptr(a5),d1
- beq.s terminate_script
- bpl.s scr_in2
- terminate_script
- bsr kill_script
- move.l errorstack(a5),sp
- bra chorus
-
- scr_in2 move.l a0,a2
- moveq #0,d0
- move.l scptr(a5),a1
- cmp.b #LF,(a1)
- beq.s .B
- .A move.b (a1)+,(a2)+
- addq.l #1,d0
- cmp.b #LF,(a1)
- bne.s .A
- .B move.b (a1)+,(a2)+ LF
- clr.b (a2) 0
- move.l a1,scptr(a5)
- btst #FLdebug,Flags+3(a5)
- beq.s .C
- clr.b noreview_flag
- bsr pr_prompt
- move.l a0,a1
- bsr pr_string
- .C rts
-
- kill_script
- move.l a0,-(sp)
- clr.b scflag(a5) clean up if no more lines left
- clr.b if_flag(a5) Make sure if structure ends
- clr.b goto_flag(a5) Make sure goto is terminated
- move.l scaddr(a5),a1
- move.l scsize(a5),d0
- bsr givemem
- move.l (sp)+,a0
- rts
-
- ** SAME AS compare_strings EXCEPT
- ** ALLOWS FOR A1 ENDING IN LF
- lf_compare_strings
- movem.l d0-d1/a0-a1,-(sp)
- bra.s .A
- .B tst.b d0
- beq.s .C RETURN EQ
- .A move.b (a0)+,d0
- move.b (a1)+,d1
- bsr compD1D0nocase
- beq.s .B return NE
- tst.b d0
- bne.s .C
- cmp.b #LF,d1
- .C movem.l (sp)+,d0-d1/a0-a1
- rts
-
-
- ** CASE INDEPENDENT STRING COMPARE. COMPARES (A0) TO (A1)
- ** RETURN EQ IF SAME
- compare_strings
- movem.l d0-d1/a0-a1,-(sp)
- bra.s .A
- .B tst.b d0
- beq.s .C RETURN EQ
- .A move.b (a0)+,d0
- move.b (a1)+,d1
- bsr compD1D0nocase
- beq.s .B return NE
- .C movem.l (sp)+,d0-d1/a0-a1
- rts
-
-
- * COPY STRING :copys null ending string from A0 to A1, Return with D0=length+1
- cp_string movem.l a0-a1,-(sp)
- moveq #0,d0
- cp_str1 addq.l #1,d0
- move.b (a0)+,(a1)+
- bne.s cp_str1
- movem.l (sp)+,a0-a1
- rts
-
- *Get line of text and seperate into up to 6 parameters
- get_line addq.l #1,count_line(a5)
- bsr clr_parms
- lea shelline(a5),a0
- tst.b mult_comm_flag(a5) SKIP PROMPT IF SCRIPT OR MULT COMMANDS
- bne.s .A
- tst.b scflag(a5)
- bne.s .B
- addq.b #1,noreview_flag(a5)
- bsr pr_prompt
- .B bsr type_in NOTE HISTORY STUFF ASSUMES SHELLINE HOLDS THE LINE
- clr.b noreview_flag(a5)
- cmp.b #';',(a0) ;is 1st character a ';'
- beq.s .C
- cmp.b #'*',(a0)
- beq.s .C
- cmp.b #'#',(a0)
- bne.s .A
- .C addq.l #4,sp ;kill return address
- bra chorus ;do next line if comment
- .A bsr handle_mult_comms MAYBE ALTER A0
- bsr handle_command_alias
- bsr handle_redirection
- btst #FLdebug,Flags+3(a5)
- beq.s gl16
- tst.b scflag(a5)
- bne.s gl16
- move.l a0,-(sp) TEST STUFF
- lea pfeil(pc),a1
- bsr pr_string
- move.l a0,a1
- bsr pr_string
- move.l (sp)+,a0
- gl16 lea parm1(a5),a2 do 1st parm seperate to establish CLI residue
- bsr get_parm
- move.l a0,d7
- tst.l d2
- beq gl3 if no parms at all
- tst.b goto_flag(a5) CHECK IF IN GOTO SEARCH MODE
- beq.s test_ifs
- move.l a0,-(sp)
- lea label_tx(pc),a0
- bsr lf_compare_strings
- bne skipline
- move.l (sp)+,a0
-
- * Script-IF handling
- test_ifs tst.b if_flag(a5) 0 if if encountered earlier
- beq.s no_ifs
- tst.b if_condition(a5) 0 if condition TRUE
- beq no_ifs
- if_false move.l a0,-(sp) push ptr to next
- lea else_tx(pc),a0
- bsr lf_compare_strings
- bne.s try_endif
- not.b if_condition(a5) flip condition flag
- skipline movem.l (sp)+,d0-d1 get rid of last plus return address
- bra chorus
- try_endif lea endif_tx(pc),a0
- bsr lf_compare_strings
- bne.s skipline
- clr.b if_flag(a5)
- bra.s skipline
-
- no_ifs move.l a1,(a2)+ save address of parm1
-
- lea CLIbuf(a5),a1
- .C move.b (a0)+,d0 skip all preceding spaces
- cmp.b #LF,d0
- beq .D
- cmp.b #" ",d0
- beq.s .C
- .B move.b d0,(a1)+
- move.b (a0)+,d0 copy sudoCLIresidue out
- cmp.b #LF,d0 only look for LF end
- bne.s .B
- .E move.b -(a1),d0 skip all ending spaces
- cmp.b #" ",d0
- beq.s .E
- addq.l #1,a1
- .D clr.b (a1) null end the copy
- move.l d7,a0
- lea endofparms(a5),a4 establish end of parms block
- gl4 bsr get_parm
- tst.l d2
- beq.s gl3
- move.l a1,(a2)+
- cmp.l a2,a4 get out if more than 25 parms
- bne.s gl4
- clr.b (a0) make sure parm ends in 0
- gl3 rts
-
- endifz clr.b if_flag(a5)
- moveq #RETURN_OK,d0
- rts
- elsez not.b if_condition(a5)
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * SKIP *
- *************************
-
- skipz move.l parm2(a5),d1
- bne test_gs
- skip_err lea goto_error_tx(pc),a1
- bsr pr_string
- moveq #RETURN_ERROR,d0
- rts
- test_gs tst.b scflag(a5) CAN ONLY GOTO FROM WITHIN SCRIPT
- beq skip_err
-
- move.l d1,a0
- lea dest_label(a5),a1
- .B move.b (a0)+,(a1)+
- bne.s .B
- move.l scaddr(a5),scptr(a5) RESET TO START OF SCRIPT
- move.b #$ff,goto_flag(a5)
- clr.b if_flag(a5) MAKE SURE IF IS TERMINATED
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * LABEL * DOES NOTHING IF NOT IN GOTO SEARCH MODE
- *************************
- labelz tst.b goto_flag(a5)
- bne.s .A
- .B moveq #RETURN_OK,D0
- RTS
- .A move.l parm2(a5),d0
- beq.s .B
- move.l d0,a0
- lea dest_label(a5),a1
- bsr compare_strings
- bne .B
- clr.b goto_flag(a5)
- bra.s .B
-
-
- *ENTRY A0=shelline ONLY HANDLES ALIASES OF FIRST KEYWORD.
- handle_command_alias
- movem.l d0-d2/a1-a4,-(sp)
- cmp.b #LF,(a0)
- beq hca_nothing_typed
- move.l a0,a1
- lea tempbuf(a5),a3
- move.b #LF,(a3)
- clr.b 1(a3) must be null end string
- lea temp2buf(a5),a2 COPY PARM AT A0 TO SEARCH STR
- .B move.b (a1)+,(a2)+
- cmp.b #LF,(a1)
- beq.s .D hca_one_parm
- cmp.b #$20,(a1)
- bne.s .B
- .D move.b (a1)+,(a3)+ COPY FROM SPACE ONWARDS to tempbuf
- bne.s .D WHOLE LINE ENDS IN NULL.
- hca_one_parm
- clr.b (a2) null end search string
-
- hca_find_it
- move.l a0,-(sp)
- bsr search_sets
- move.l (sp)+,a0
- tst.l d0
- beq hca_nothing_typed
- move.l d0,a2
-
- lea set_defn(a2),a2 A2=set defn
- lea tempbuf(a5),a3 A3=line after alias
- move.l a0,a1 A1=shelline ptr
- moveq #7,d0
- .F clr.l -(sp) push down eight times 0=no entry.
- dbra d0,.F
- .E move.b (a2)+,d0 handle %1...$1
- beq not_much_of_an_alias
- cmp.b #$20,d0 skip spaces
- beq.s .E
- cmp.b #'%',d0
- bne.s no_extra_parms
- move.b (a2)+,d0
- and.w #$0007,d0 only allow %0 --> %7
- .A move.b (a3)+,d1 find where the next param starts
- cmp.b #LF,d1
- beq.s .C if no param then pt A3 to lf again
- cmp.b #$20,d1
- beq.s .A
- .D lsl.w #2,d0 x 4
- move.l a3,0(sp,d0.w)
- subq.l #1,0(sp,d0.w) put address of param on stack
- .B move.b (a3)+,d1 get a3 to pt to next space
- cmp.b #LF,d1
- beq .C
- cmp.b #$20,d1
- bne.s .B
- .C lea -1(a3),a3 a3 ts to space
- bra.s .E do for more params
- get_next_character
- move.b (a2)+,d0
- no_extra_parms
- cmp.b #'$',d0
- bne.s .A
- move.b (a2)+,d0 grab number after $
- beq.s not_much_of_an_alias
- and.w #$0007,d0
- lsl.w #2,d0 x 4
- move.l 0(sp,d0.w),d1
- beq.s get_next_character
- move.l d1,a4
- .B move.b (a4)+,(a1)+ copy param N
- cmp.b #LF,(a4)
- beq.s .C
- cmp.b #$20,(a4)
- bne.s .B
- .C bra.s get_next_character
- .A move.b d0,(a1)+ copy DEFN -> SHELLINE
- tst.b d0
- bne.s get_next_character
-
- lea -1(a1),a1
- not_much_of_an_alias
- lea 32(sp),sp ** NOTE STACK CHANGE
- .D move.b (a3)+,(a1)+ copy tempbuf onto end
- bne.s .D
- clr.b mult_comm_flag(a5)
- bsr handle_mult_comms
- bsr handle_command_alias
- clr.b mult_comm_flag(a5)
- bsr handle_mult_comms put LF at end Allow for aliases with ;'s
-
- hca_nothing_typed
- movem.l (sp)+,d0-d2/a1-a4
- rts
-
-
-
- clr_parms movem.l a0-a1,-(sp)
- lea parm1(a5),a0
- lea endofparms(a5),a1
- clr_loop1 clr.l (a0)+
- cmp.l a0,a1
- bne.s clr_loop1
- movem.l (sp)+,a0-a1
- rts
-
- * GET PARM line pted to by A0
- * LINE MUST END IN LF THEN 0
- * returns A1 pointing to the address where the parm starts
- * puts a 0 over the space or lf where it ends .A0 pts to next bit on end
- * return d2=0 if got all possible commands from line
- get_parm moveq #$20,d2 D2=delimiter
- get_parm1 move.l a0,a1 ;make sure we can get the address before
- move.b (a0)+,d1 ;skip spaces
- beq.s last_parm2
- cmp.b #$20,d1
- beq.s get_parm1
- cmp.b #$9,d1 skip tabs
- beq.s get_parm1
- cmp.b #LF,d1 ;handle idiots who type spaces at end of line
- beq.s last_parm
- cmp.b #'"',d1 ;handle double quotes
- bne.s gp2
- addq.l #1,a1
- moveq #'"',d2 SET DELIMITER = "
- bra.s gp2
- gp4 addq.l #1,a0 ;make sure pts to after quotes d1 is dummy
- gp2 move.b (a0)+,d1 ;a0 pts to after the space on exit
- cmp.b #LF,d1
- beq.s gp3
- cmp.b #$5c,d1 allow for \" (nested quotes)
- beq.s gp4
- cmp.b d2,d1
- bne.s gp2
- clr.b -1(a0) ;make sure last byte is 0
- rts
- last_parm clr.b -1(a0)
- last_parm2 moveq #0,d2 ;signify the end
- rts
- gp3 lea -1(a0),a0 if ends in LF then dont null end, catch that next time
- rts
-
- close_redirection
- move.l stdin(a5),d0
- cmp.l inhandle(a5),d0
- beq cls_outred
- move.l thistask(a5),a0
- move.l pr_CIS(a0),d1
- move.l d0,pr_CIS(a0) restore old stdin
- move.l d0,inhandle(a5)
- jsr _LVOClose(a6)
- cls_outred
- move.l stdout(a5),d0
- cmp.l outhandle(a5),d0
- beq cls_nothing
- move.l thistask(a5),a0
- move.l pr_COS(a0),d1
- move.l d0,pr_COS(a0) restore old stdout
- move.l d0,outhandle(a5)
- jsr _LVOClose(a6)
- tst.l MPipePtr(a5)
- beq.s cls_nothing
- movem.l d2-d7/a2-a4,-(sp)
- bsr raw_on
- sub.l a3,a3
- bsr viewbuffer
- movem.l (sp)+,d2-d7/a2-a4
- clr.l MPipePtr(a5)
- cls_nothing
- rts
-
- * entry A0 pts to shelline
- handle_redirection
- movem.l d0/a0-a3,-(sp)
- lea tempbuf(a5),a2
- redir_2 move.b (a0)+,d0 CHECK FOR REDIRECTION CHARS < >
- cmp.b #LF,d0
- bne.s .C
- .F movem.l (sp)+,d0/a0-a3
- rts
- .C cmp.b #'"',d0 HANDLE QUOTES
- bne.s .A
- .B move.b (a0)+,d0
- cmp.b #LF,d0
- beq .F
- cmp.b #'"',d0
- bne.s .B
- .A cmp.b #$20,d0
- bne.s redir_2
- move.b (a0),d0 TEST CHAR AFTER SPACE.
- cmp.b #'>',d0
- beq.s redir_out
- cmp.b #'<',d0
- bne.s redir_2
- redir_in
- move.l #MODE_OLDFILE,d2
- cmp.b #">",1(a0)
- beq.s redir_both
- bsr redir_open
- bsr ChngIn
- move.l a3,a0
- bra redir_2 KEEP SEARCHING
- redir_both
- bsr redir_open
- bsr ChngIn
- bra.s re_out2
- redir_out
- cmp.b #">",1(a0)
- beq.s redir_append
- lea -1(a0),a3 ALIGN WITH SPACE
- bsr copy_redirector
- move.b (a2),d0
- bset #5,d0
- cmp.b #"m",d0
- bne.s re_out2
- tst.b 1(a2)
- bne.s re_out2
- clr.b (a2) redir to MORE, send to nil:
- move.l ReviewPtr(a5),MPipePtr(a5)
- re_out2 move.l #MODE_NEWFILE,d2
- bsr redir_open2
- bsr ChngOut
- move.l a3,a0
- bra redir_2
- redir_append
- move.l #MODE_READWRITE,d2
- bsr redir_open
- bsr ChngOut
- move.l d0,d1
- moveq #0,d2 set position
- moveq #1,d3 set mode
- jsr _LVOSeek(a6)
- move.l a3,a0
- bra redir_2
-
- ChngIn move.l thistask(a5),a0
- move.l d0,pr_CIS(a0) MAKE STDIN DIFFERENT.
- move.l d0,inhandle(a5)
- rts
- ChngOut move.l thistask(a5),a0
- move.l d0,pr_COS(a0)
- move.l d0,outhandle(a5)
- rts
-
- redir_open
- lea -1(a0),a3 ALIGN WITH SPACE
- bsr copy_redirector
- redir_open2
- tst.b (a2)
- bne.s .B
- lea connil(pc),a2
- .B btst #FLdebug,Flags+3(a5)
- beq.s .A
- lea star(pc),a2
- .A move.l a2,d1
- jsr _LVOOpen(a6)
- tst.l d0
- beq DOSerr
- rts
-
- ** ENTRY A0 pts redirection symbol. A2 pts to area to save redirection name
- ** EXIT A2 area holds null end string and redirection name is deleted from
- ** shelline
- copy_redirector
- movem.l a0-a2,-(sp)
- move.l a0,a1 SAVE START OF REDIRECTION STRING
- move.b (a0)+,d0 BUMP PAST '<' or '>'
- cpred3 move.b (a0)+,d0
- cmp.b #$20,d0
- beq.s cpredsp
- cmp.b #LF,d0
- beq.s cpredlf
- cmp.b #'>',d0 HANDLE APPEND REDIRECTION PROPERLY
- beq.s cpred3
- move.b d0,(a2)+ COPY NEWSTDIN/OUT TO NONSTDIN/OUT
- bra.s cpred3
- cpredlf lea -1(a0),a0
- lea -1(a1),a1
- cpredsp clr.b (a2)+ A0 should point to after the space or lf
- lea shelline+SHELLINE_SIZE(a5),a2
- move.l a1,d0
- sub.l a0,d0
- add.l d0,next_comm_ptr(a5) offset next_comm_ptr
- cpred5 move.b (a0)+,(a1)+ delete redirection string from shelline
- cmp.l a0,a2
- bhi.s cpred5
- movem.l (sp)+,a0-a2
- rts
-
- ** V1.14 multiple commands on command line. Delimit by ';'
- * ENTRY A0 pts to shelline, EXIT A0 pts to start of next bit on line.
- handle_mult_comms
- movem.l d0/a1,-(sp)
- tst.b mult_comm_flag(a5)
- beq.s .A
- move.l next_comm_ptr(a5),a0
- .A move.l a0,a1
- .B move.b (a1)+,d0
- cmp.b #$5c,d0 is it \ ?
- beq.s .E
- cmp.b #'"',d0 ignore semi-colons between quotes
- bne.s .C
- .D move.b (a1)+,d0
- beq.s endofline END OF LINE IS NULL.
- cmp.b #LF,d0
- beq.s fndret
- cmp.b #'"',d0
- bne.s .D
- bra.s .B
- .E move.b (a1)+,d0
- bra.s .F
- .C cmp.b #';',d0
- beq fndsemi
- .F cmp.b #LF,d0
- bne.s .B
- fndret tst.b (a1) IF NULL FOLLOWS LF THEN AT END OF LINE
- bne.s fndsemi
- endofline clr.b mult_comm_flag(a5)
- movem.l (sp)+,d0/a1
- rts
- fndsemi move.b #LF,-1(a1) REPLACE ; or LF WITH LF
- move.l a1,next_comm_ptr(a5)
- move.b #1,mult_comm_flag(a5)
- movem.l (sp)+,d0/a1
- rts
-
- ******************************
- * Iconify Shell V2.3 *
- WaitAppIcon
- movem.l d2-d7/a2-a4,-(sp)
- clr.b tempbuf(a5)
- cmp.w #36,kickver(a5)
- blo .G
- bsr KillAppWin
- bsr raw_off
- bsr clkof2
- bsr CloseWin
-
- tst.l diskobj(a5)
- bne.s .I
- bsr OpenIconLib
- beq.s .A
- moveq #3,d0
- jsr _LVOGetDefDiskObject(a6)
- move.l d0,diskobj(a5)
- beq .A
- .I bsr OpenWBLib
- beq .A
- moveq #0,d0 opened workbench.library
- moveq #0,d1
- move.l app_name(a5),a0
- move.l thistask(a5),a1
- lea pr_MsgPort(a1),a1
- move.l a1,d3
- sub.l a2,a2
- move.l diskobj(a5),a3
- sub.l a4,a4
- jsr _LVOAddAppIconA(a6) add appicon
- move.l d0,d2
- beq.s .B
- move.l 4.w,a6
- .C move.l d3,a0
- jsr _LVOWaitPort(a6) wait for one message
- bsr GetAppIMsgs
- move.l wbbase(a5),a6
- move.l d2,a0
- jsr _LVORemoveAppIcon(a6) remove appicon
- .B bsr GetAppIMsgs
-
- .A move.l dosbase(a5),a6
- tst.b openwin_flag(a5) restore window
- beq.s .G
- move.l thistask(a5),a3
- move.l CLIptr(a5),a2
- move.l windowname(a5),d1
- clr.b openwin_flag(a5)
- bsr OpenWin
- beq cloga
- jsr _LVOOutput(a6) SAVE THE CONSOLE HANDLERS
- move.l d0,outhandle(a5)
- move.l d0,stdout(a5)
- jsr _LVOInput(a6)
- move.l d0,inhandle(a5)
- move.l d0,stdin(a5)
- bsr InitAppWin
- tst.b memclk_flag(a5)
- beq.s .G
- bsr clkon
- .G movem.l (sp)+,d2-d7/a2-a4
- lea tempbuf(a5),a1
- tst.b (a1)
- beq.s .D
- bsr print_def
- .D rts
-
- GetAppIMsgs
- move.l 4.w,a6
- .B move.l d3,a0
- jsr _LVOGetMsg(a6) get all messages
- tst.l d0
- beq.s .A
- move.l d0,a2
- cmp.w #8,am_Type(a2)
- bne.s .B
- bsr ProcessApp
- move.l a2,a1
- jsr _LVOReplyMsg(a6) reply them
- bra.s .B
- .A rts
-
- ProcessApp ;Message in a2
- move.l a2,-(sp)
- move.l am_NumArgs(a2),d0
- move.l am_ArgList(a2),a0
- lea tempbuf(a5),a2
- bra.s .D
- .E move.l (a0)+,d1 process all args
- beq.s .C get name from lock to dir
- movem.l d0-d3/a0/a3/a6,-(sp)
- move.l dosbase(a5),a6
- jsr _LVODupLock(a6)
- move.l a2,a0
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- .A tst.b (a2)+
- bne.s .A
- subq.l #1,a2
- cmp.b #":",-1(a2)
- beq.s .B
- move.b #"/",(a2)+ /-end path
- .B movem.l (sp)+,d0-d3/a0/a3/a6
- .C move.l (a0)+,d1 get filename
- beq.s .D
- move.l d1,a1
- bsr addstring
- move.b #" ",(a2)+ space-end
- .D dbra d0,.E
- clr.b (a2)
- move.l (sp)+,a2
- rts
-
- ** evaluate entire name associated with lock in D0, store string in A0
- ** Return D1 = last lock to unlock
- ** Reg usage: d0,d1,d2,d3,a0,a1,a3 (must not use A2)
-
- OpenIconLib
- move.l iconbase(a5),d0
- bne.s .A
- move.l 4.w,a6
- lea iconname(pc),a1
- jsr _LVOOldOpenLibrary(a6) icon-library
- move.l d0,iconbase(a5)
- .A move.l d0,a6
- rts
-
- OpenWBLib
- move.l wbbase(a5),d0
- bne.s .A
- move.l 4.w,a6
- lea wbname(pc),a1
- jsr _LVOOldOpenLibrary(a6)
- move.l d0,wbbase(a5)
- .A move.l d0,a6
- rts
-
- **********************************************
- * Create CLI-Interface-Structure V2.0 *
- CreateCLI
- move.l thistask(a5),a3
- move.l pr_WindowPtr(a3),window_old(a5)
- tst.b CLIflag(a5)
- beq CCli3
- clr.l EntryA0(a5) started from WB
- move.l #64+$28+$50,d0
- move.l #MEMF_CLEAR+1,d1 memory for CLI
- bsr iwantmem
- moveq #1,d1
- tst.l d0
- beq CCli2
- move.l d0,a2
- lsr.l #2,d0
- move.l d0,pr_CLI(a3)
- move.l dl_Root(a6),a0
- move.l (a0),a0
- add.l a0,a0
- add.l a0,a0
- moveq #0,d2
- move.l (a0),d0
- subq.l #1,d0
- .C addq.l #1,d2
- addq.l #4,a0
- tst.l (a0) look for free CLI-Number
- dbeq d0,.C
- moveq #2,d1
- tst.l (a0)
- bne CCli2
- lea pr_MsgPort(a3),a1
- move.l a1,(a0)
- move.l d2,pr_TaskNum(a3)
- moveq #10,d0
- move.l d0,cli_FailLevel(a2)
- moveq #-1,d0
- move.l d0,cli_Interactive(a2)
- move.l #1000,cli_DefaultStack(a2) 1000 LONGs
- move.l pr_FileSystemTask(a3),filesys_old(a5)
- lea 64(a2),a0
- move.l a0,d0
- lsr.l #2,d0
- move.l d0,cli_CommandFile(a2)
- lea 64+$28(a2),a0
- move.l a0,d0
- lsr.l #2,d0
- move.l d0,cli_CommandName(a2)
- IFD DEBUG
- tst.l wb_msg(a5)
- beq CreateCLI2 no WB-Msg -> CreateCLI2
- ENDC
- move.l wb_msg(a5),a0
- tst.l sm_Process(a0)
- beq CreateCLI3 newcli/run -> CreateCLI3
- move.l sm_ArgList(a0),a1
- moveq #2,d0
- cmp.l sm_NumArgs(a0),d0
- bhi.s .H Project ?
- addq.l #8,a1
- .H move.l (a1),a0 Lock on Current Dir
- moveq #3,d1
- move.l a0,d0
- beq CCli2
- move.l a0,d1
- move.l dosbase(a5),a6
- jsr _LVODupLock(a6) WB wants to free its own lock
- bsr SetCurrentDir
- move.l 4.w,a6
- lea wbenchtx(pc),a1
- jsr _LVOFindTask(a6)
- tst.l d0
- beq.s .E
- move.l d0,a0
- tst.l pr_CLI(a0)
- beq.s .E
- move.l dosbase(a5),a6
- bsr CopyPaths copy paths from workbench
- .E bsr OpenIconLib
- moveq #4,d1
- tst.l d0
- beq CCli2
- move.l d0,a4
- move.l wb_msg(a5),a0
- move.l sm_ArgList(a0),a1
- moveq #2,d0
- cmp.l sm_NumArgs(a0),d0
- bhi.s .I Project ?
- move.l 12(a1),d0
- beq.s .I
- move.l d0,EntryA0(a5) Name of Project as Script
- addq.l #8,a1
- .I move.l 4(a1),a0 Name of Process
- jsr _LVOGetDiskObject(a6)
- moveq #5,d1
- move.l d0,diskobj(a5)
- beq CCli2
- move.l d0,a0
- moveq #0,d0
- bset #31,d0 unset icon position
- move.l d0,$3a(a0) CurrentX
- move.l d0,$3e(a0) CurrentY
- move.b #8,$30(a0) Type=AppIcon
- move.l do_ToolTypes(a0),d3 d3=ToolTypes
- move.l d3,a0
- lea xpostool(pc),a1
- jsr _LVOFindToolType(a6) Look for XPOS-ToolType
- tst.l d0
- beq.s .G
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq.s .G
- move.l diskobj(a5),a0
- move.l d0,$3a(a0)
- .G move.l d3,a0
- lea ypostool(pc),a1
- jsr _LVOFindToolType(a6) Look for YPOS-ToolType
- tst.l d0
- beq.s .J
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq.s .J
- move.l diskobj(a5),a0
- move.l d0,$3e(a0)
- .J move.l d3,a0
- lea nametool(pc),a1
- jsr _LVOFindToolType(a6) Look for ICONNAME-ToolType
- tst.l d0
- beq.s .K
- move.l d0,app_name(a5)
- .K move.l d3,a0
- lea iconifytool(pc),a1
- jsr _LVOFindToolType(a6) Look for ICONIFY-ToolType
- tst.l d0
- beq.s .B
- bset #FLappicon,Flags+3(a5)
- bsr WaitAppIcon
- .B move.l d3,a0
- lea wintool(pc),a1
- jsr _LVOFindToolType(a6) Look for WINDOW-ToolType
- lea conname(pc),a0
- tst.l d0
- beq.s .D
- move.l d0,a0
- .D move.l a0,d1
- move.l dosbase(a5),a6
- bsr OpenWin Open Window
- beq CCli2a
- move.l d3,a0
- lea scripttool(pc),a1
- move.l a4,a6
- jsr _LVOFindToolType(a6) Look for SCRIPT-ToolType
- tst.l d0
- beq.s .F
- move.l d0,EntryA0(a5)
- .F move.l d3,a0
- lea norawtool(pc),a1
- jsr _LVOFindToolType(a6) Look for NORAW-ToolType
- tst.l d0
- beq.s .A
- clr.l ConsoleSwitch(a5)
- .A move.l d3,a0
- lea commandtool(pc),a1
- jsr _LVOFindToolType(a6) Look for COMMAND-ToolType
- move.l d0,d2
- bsr Com2Script
- bne.s CCli2a
- CCli1 move.l dosbase(a5),a6
- moveq #0,d0
- rts
- CCli2 bsr GuruIt
- CCli2a move.l dosbase(a5),a6
- moveq #-1,d0
- rts
-
- CCli3 move.l pr_COS(a3),outhandle(a5) started from CLI
- move.l pr_ConsoleTask(a3),ConsoleSwitch(a5)
- move.l pr_CurrentDir(a3),d1
- bne.s .D
- moveq #-2,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq .D
- bsr SetCurrentDir
- .D move.l EntryA0(a5),d0 process CLI-Command-Line
- beq.s CCli1
- clr.l EntryA0(a5)
- move.l d0,a0
- lea parm2(a5),a2
- lea endofparms(a5),a4 establish end of parms block
- .A bsr get_parm
- tst.l d2
- beq.s .B
- move.l a1,(a2)+
- cmp.l a2,a4 get out if more than 25 parms
- bne.s .A
- clr.b (a0) make sure last parm ends in 0
- .B lea parm2(a5),a1
- bsr.s StartOpts
- bne.s CCli2a
- tst.l d3
- beq.s .C
- clr.l ConsoleSwitch(a5)
- .C tst.l d1
- beq.s CCli1
- move.l thistask(a5),a3
- move.l pr_CLI(a3),a2
- add.l a2,a2
- add.l a2,a2
- bsr OpenWin
- tst.l d0
- beq.s CCli2a
- tst.l d3
- beq CCli1
- clr.l ConsoleSwitch(a5)
- bra CCli1
-
- StartOpts ;examine startup-options, parms in a1
- moveq #0,d1
- moveq #0,d2
- moveq #0,d3
- .A move.l (a1)+,d0 ;returns window in d1, script in EntryA0
- beq.s Com2Script ;and start-command in d2, d3>0 if egs
- move.l d0,a0
- cmp.b #"-",(a0)+
- bne.s .H
- move.b (a0)+,d0
- or.b #$20,d0
- cmp.b #"s",d0 -s for Script
- bne.s .B
- move.l a0,EntryA0(a5)
- bra.s .A
- .B cmp.b #"w",d0 -w for Window
- bne.s .C
- move.l a0,d1
- bra.s .A
- .C cmp.b #"c",d0 -c for Command
- bne.s .D
- move.l a0,d2
- bra.s .A
- .D cmp.b #"d",d0 -d for detach
- bne.s .E
- clr.l -4(a1)
- bsr initialise_default
- bsr newcliz
- moveq #-1,d0
- rts end it
- .E cmp.b #"r",d0 -r for not Resident
- beq.s .A
- cmp.b #"n",d0 -n for Noraw
- bne.s .H
- moveq #1,d3
- bra.s .A
- .H lea useit(pc),a1
- bsr pr_stringlf
- moveq #-1,d0
- rts
-
- Com2Script ;Makes a command to script, d2=command
- move.l d1,-(sp) ;returns d0=0 for OK
- moveq #1,d0
- tst.l d2
- beq.s .B
- lea null(pc),a0
- move.l a0,EntryA0(A5)
- move.l d2,a0
- moveq #0,d0
- .A addq.l #1,d0
- tst.b (a0)+
- bne.s .A
- move.l d0,scsize(a5)
- moveq #1,d1
- bsr iwantmem
- beq.s .B
- move.l d0,scaddr(a5)
- move.l d0,scptr(a5)
- move.b #1,scflag(a5) make shell think text lines are in memory
- move.l d0,a1
- move.l d2,a0
- .C move.b (a0)+,(a1)+
- bne.s .C
- move.b #LF,-1(a1)
- moveq #1,d0
- .B move.l (sp)+,d1
- subq.l #1,d0
- rts
-
- SetCurrentDir ;lock in d0
- move.l d0,a0
- add.l a0,a0
- add.l a0,a0
- move.l fl_Task(a0),pr_FileSystemTask(a3)
- move.l d0,d1
- jsr _LVOCurrentDir(a6)
- move.l d0,cdir_old(a5)
- rts
-
- * Open Window for both Input and Output, Name in d1 , a2,a3 *
- OpenWin move.l dosbase(a5),a6
- moveq #0,d0
- cmp.b #1,openwin_flag(a5)
- beq .C
- move.b #1,openwin_flag(a5)
- move.l pr_CIS(a3),OldCIS(a5)
- move.l pr_COS(a3),OldCOS(a5)
- clr.l pr_CIS(a3) avoid freeing it
- clr.l pr_COS(a3)
- move.l pr_ConsoleTask(a3),OldCTask(a5)
- clr.l ConsoleSwitch(a5)
- move.l d1,a0
- move.l a0,windowname(a5)
- tst.b (a0)
- beq.s .A NIL:
- move.l #MODE_NEWFILE,d2
- jsr _LVOOpen(a6) open output-Window
- moveq #11,d1
- move.l d0,pr_COS(a3)
- beq .B
- move.l d0,d1
- move.l d0,cli_StandardOutput(a2)
- move.l d0,cli_CurrentOutput(a2)
- lsl.l #2,d0
- move.l d0,a0
- move.l fh_Type(a0),d0
- move.l d0,pr_ConsoleTask(a3)
- move.l d0,ConsoleSwitch(a5)
- jsr _LVOIsInteractive(a6)
- moveq #12,d1
- tst.l d0
- beq.s .B
- lea star(pc),a0
- move.l a0,d1
- move.l #MODE_OLDFILE,d2
- jsr _LVOOpen(a6) open input-window
- moveq #13,d1
- move.l d0,pr_CIS(a3)
- beq .B
- move.l d0,cli_StandardInput(a2)
- move.l d0,cli_CurrentInput(a2)
- .A moveq #-1,d0
- rts d0<>0 if OK
- .C moveq #10,d1
- .B bsr GuruIt d0=0 on error
- rts
-
- CloseWin
- move.l thistask(a5),a3
- tst.b openwin_flag(a5)
- beq.s .G
- move.l pr_CIS(a3),d1
- beq.s .C
- jsr _LVOClose(a6) close input-window
- .C move.l pr_COS(a3),d1
- beq.s .D
- jsr _LVOClose(a6) close output-window
- .D move.l OldCIS(a5),d0
- move.l d0,pr_CIS(a3)
- move.l OldCOS(a5),d1
- move.l d1,pr_COS(a3)
- move.l OldCTask(a5),pr_ConsoleTask(a3)
- tst.l pr_CLI(a3)
- beq.s .G
- move.l pr_CLI(a3),a2
- add.l a2,a2
- add.l a2,a2
- move.l d0,cli_StandardInput(a2)
- move.l d0,cli_CurrentInput(a2)
- move.l d1,cli_StandardOutput(a2)
- move.l d1,cli_CurrentOutput(a2)
- .G rts
-
- * Create CLI-Interface-Structure without WB-Message V2.0 *
- IFD DEBUG
- CreateCLI2
- lea conname(pc),a0
- move.l a0,d1
- bsr OpenWin
- beq.s .B
- lea ramdisk(pc),a0
- move.l a0,d1
- moveq #-2,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq .B
- bsr SetCurrentDir
- moveq #0,d0
- rts
- .B moveq #-1,d0
- rts
-
- ramdisk dc.b "RAM:",0
- even
- ENDC
-
- * Create CLI-Interface-Structure with special message V2.0 *
- * a3:Process a2:CLI_Struct *
- *sm_NumArgs: General Memory Block
- *sm_ToolWindow: Current Dir
- CreateCLI3
- move.b #1,WBflag(a5) not started from WB
- move.l sm_NumArgs(a0),a4 wb_msg in a0
- move.l sm_ToolWindow(a0),d1
- jsr _LVODupLock(a6) COPY CD
- moveq #15,d1
- tst.l d0
- beq cce3
- bsr SetCurrentDir
- move.l outhandle(a4),outhandle(a5) PROCESS PARMS
- lea parm2(a4),a1
- bsr StartOpts
- clr.l outhandle(a5)
- tst.l d0
- bne cce2
- move.l thistask(a4),a0 OPEN WINDOW
- move.l pr_ConsoleTask(a0),pr_ConsoleTask(a3)
- lea conname(pc),a0
- tst.l d1
- bne.s .H
- move.l a0,d1
- .H bsr OpenWin
- beq cce2
- tst.l d3
- beq.s .B
- clr.l ConsoleSwitch(a5)
- .B move.l thistask(a4),a0 COPY SEARCH PATHS
- bsr CopyPaths
- lea prompt_args(a4),a0 COPY PROMPT
- lea prompt_args(a5),a1
- .G move.b (a0)+,(a1)+
- bne.s .G
- lea now(a4),a0 COPY HISTORY
- lea now(a5),a1
- move.w #HISTORY_SIZE+12-1,d0
- .D move.b (a0)+,(a1)+
- dbra d0,.D
- move.l CLIptr(a4),a0
- move.l cli_FailLevel(a0),cli_FailLevel(a2)
- move.l Flags(a4),Flags(a5)
- moveq #ctrl_inite-ctrl_init-1,d0 COPY CTRL-CODES
- lea ctrl_codes(a4),a0
- lea ctrl_codes(a5),a1
- .E move.b (a0)+,(a1)+
- dbra d0,.E
- lea ignoreit(a4),a0
- lea ignoreit(a5),a1
- .F move.b (a0)+,(a1)+
- bne .F
- ccs3 movem.l a2-a4,-(sp) COPY ALL ALIASES
- moveq #0,d3 Link Pointer
- move.l first_set_defn(a4),d0 old aliases
- beq .A
- .B move.l d0,a3
- move.l set_size(a3),d0
- move.l d0,d2
- moveq #1,d1
- bsr iwantmem get mem for set
- beq.s .A
- move.l d0,a2
- move.l a3,a0 copy whole set
- move.l a2,a1
- move.l d2,d1
- subq.l #1,d2
- .C move.b (a0)+,(a1)+
- dbra d2,.C
- move.l d1,set_size(a2) init set
- move.l d3,(a2)
- move.l a2,d3
- move.l (a3),d0 check next set address
- bne .B
- .A move.l d3,first_set_defn(a5)
- move.l ReviewSize(a4),d0 CREATE REVIEW-BUFFER
- beq.s .D
- bsr MakeReview
- .D movem.l (sp)+,a2-a4
- move.l EntryA0(a5),d0 SCRIPT GIVEN ?
- beq.s .H
- move.l d0,a0
- lea prompt_string(a5),a1 there is enough place
- move.l a1,EntryA0(a5)
- .F move.b (a0)+,(a1)+ Copy Script-Parm
- bne.s .F
- .H move.l 4.w,a6
- move.l wb_msg(a5),a1
- jsr _LVOReplyMsg(a6)
- clr.l wb_msg(a5)
- move.l dosbase(a5),a6
- moveq #0,d0
- rts
- cce3 bsr GuruIt
- cce2 moveq #-1,d0
- rts
-
-
- * Remove CLI-Interface-Structure V2.0 *
- RemoveCLI
- move.l thistask(a5),a3
- move.l window_old(a5),pr_WindowPtr(a3)
- move.l old_homedir(a5),d0
- beq.s .B
- move.l d0,pr_HomeDir(a3)
- .B move.l cdback(a5),d1
- beq.s .H
- jsr _LVOUnLock(a6)
-
- .H bsr clkoff
- bsr CloseWin
- move.l diskobj(a5),d0
- beq.s .F
- move.l d0,a0
- move.l iconbase(a5),a6
- jsr _LVOFreeDiskObject(a6)
- .F move.l 4.w,a6
- move.l iconbase(a5),d0
- beq.s .A
- move.l d0,a1
- jsr _LVOCloseLibrary(a6)
- .A move.l wbbase(a5),d0
- beq.s .I
- move.l d0,a1
- jsr _LVOCloseLibrary(a6)
- .I move.l dosbase(a5),a6
- move.l pr_CLI(a3),d0
- beq remend
- lsl.l #2,d0
- move.l d0,a2
- moveq #10,d0
- move.l d0,cli_FailLevel(a2)
- move.l old_setname(a5),d0
- beq.s remcli
- move.l d0,cli_SetName(a2)
- lsl.l #2,d0
- move.l d0,a1
- lea CD_string(a5),a0
- .E move.b (a0)+,(a1)+ copy current dir name
- bne.s .E
- move.l old_prompt(a5),cli_Prompt(a2)
-
- remcli tst.b CLIflag(a5)
- beq.s remend
- clr.l pr_CLI(a3) clear CLI-Pointer
- move.l pr_TaskNum(a3),d0
- beq.s .E
- lsl.l #2,d0
- move.l dl_Root(a6),a0
- move.l (a0),a0
- add.l a0,a0
- add.l a0,a0
- add.l d0,a0
- clr.l (a0) free task-number
- clr.l pr_TaskNum(a3)
- .E lea cli_CommandDir(a2),a4
- bsr DeletePaths free search paths
- move.l cdir_old(a5),d1
- jsr _LVOCurrentDir(a6)
- move.l d0,d1
- beq.s .B
- jsr _LVOUnLock(a6) free current dir
- .B move.l filesys_old(a5),pr_FileSystemTask(a3)
- clr.l pr_Result2(a3)
- move.l #64+$28+$50,d0
- move.l a2,a1
- bsr givemem free memory of CLI
- remend move.l dosbase(a5),a6
- rts
-
- GuruIt ;get errornumber in d1 and display a recoverable alert
- movem.l d0-d1/a0-a1/a6,-(sp)
- lea tempbuf(a5),a0
- move.l a0,a1
- clr.b (a1)+
- move.b #250,(a1)+
- move.b #15,(a1)+
- move.l d1,d0
- bsr qpr10
- clr.b (a1)+
- clr.b (a1)+
- move.l intuibase(a5),a6
- moveq #0,d0
- moveq #35,d1
- jsr _LVODisplayAlert(a6)
- movem.l (sp)+,d0-d1/a0-a1/a6
- rts
-
- *CHECK WHETHER THERE IS ENOUGH STACK FREE V2.0 *
- ;d0=requested stacksize
- stacktest movem.l d0-d1/a0-a1,-(sp)
- move.l topstack(a5),a0
- sub.l sp,a0
- move.l a0,d1
- add.l d0,d1
- add.l #1600,d1 ;allow some bytes for DOS
- cmp.l stacksize(a5),d1
- blo.s .A
- lea stack_tx(pc),a1
- bsr pr_stringlf
- moveq #-1,d0
- bra.s .B
- .A moveq #0,d0
- .B movem.l (sp)+,d0-d1/a0-a1
- rts
-
- too_less_args
- cmp.w #36,kickver(a5)
- blo.s .A
- movem.l a0-a1,-(sp)
- moveq #116,d0
- bsr pr_DOSerr
- movem.l (sp)+,a0-a1
- bra.s .B
- .A lea less_args_tx(pc),a1
- bsr pr_stringlf
- .B move.l #RETURN_BAD,d0
- rts
-
- *SendPacket-Error-Tester
- PKTerr tst.l sp_res1(a5)
- bne .A
- move.l sp_res2(a5),d0
- bra.s pr_galactic
- .A rts
- *DOSERRor but Unlock first using D7 as the lock
- DOSerrUL move.l d7,d1 ;Assume D7=lock
- beq.s DOSerr
- move.l thistask(a5),a2
- move.l pr_Result2(a2),d2
- jsr _LVOUnLock(a6)
- move.l d2,pr_Result2(a2)
- *DOSERRor handler D0=0 on entry
- DOSerr jsr _LVOIoErr(a6)
- cmp.l #232,d0
- bne.s pr_galactic
- moveq #0,d0
- rts ;Return if ERROR_NO_MORE_ENTRIES
- pr_galactic
- bsr.s pr_DOSerr ;entry for dospacket
- galactic move.l errorstack(a5),sp ;restore stack
- moveq #RETURN_BAD,d0
- bra chkfail ;reenter shell loop
-
- maybeDOSerr ;checks if d0=0, then prints DOSerr
- move.l d0,-(sp)
- bne.s .A
- jsr _LVOIoErr(a6)
- bsr pr_DOSerr error occured
- .A move.l (sp)+,d0
- rts
-
- * ENTRY D0=dos error number
- pr_DOSerr
- cmp.w #36,kickver(a5)
- blo.s .E
- movem.l d0-d4/a2,-(sp)
- move.l d0,d1
- beq.s .F
- lea NewPrintBuffer(a5),a2
- lea farb2(pc),a1
- bsr addstring
- move.l a2,d3
- moveq #110,d4
- move.l parm1(a5),d2
- jsr _LVOFault(a6)
- lea NewPrintBuffer(a5),a1
- bsr pr_error
- lea farb1(pc),a1
- bsr pr_error
- lea lf(pc),a1
- bsr pr_error
- .F movem.l (sp)+,d0-d4/a2
- rts
- .E lea doserrtx(pc),a1
- bsr pr_error
- lea doserror_text(pc),a1 v1.21 handle textual errors
- bra.s .C
- .B tst.b (a1)+
- bne.s .B
- .C move.b (a1)+,d1
- beq.s .A
- cmp.b d1,d0
- bne.s .B
- bsr pr_error
- .A bsr print10
- lea lf(pc),a1
- bsr pr_error
- .D rts
-
- * fix up parameters that exist or not
- fixpam32 move.l parm3(a5),d0
- move.l d0,a1
- bne.s fixpam2
- lea null(pc),a1
- move.l a1,parm3(a5)
- fixpam2 move.l parm2(a5),d0
- move.l d0,a0
- bne.s fxpam
- lea null(pc),a0
- move.l a0,parm2(a5)
- fxpam rts
-
- *************************
- * RENAME *
- *************************
- renamez bsr fixpam32
- ;DON'T PUT ANYTHING HERE
- * A0-> oldname A1-> newname
- rename move.l a0,d1
- move.l a1,d2
- jsr _LVORename(a6)
- tst.l d0
- beq DOSerr
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * MAKEDIR *
- *************************
- makedirz lea parm2(a5),a4
- .A move.l (a4)+,d1
- beq.s .B
- bsr.s mkdir
- bra.s .A
- .B moveq #RETURN_OK,d0
- rts
-
- *MAKEDIR D1-> directory name
- mkdir jsr _LVOCreateDir(a6)
- tst.l d0
- beq DOSerr
- move.l d0,d1
- jsr _LVOUnLock(a6)
- * moveq #0,d0
- rts
-
- *************************
- * PROMPT *
- *************************
- promptz tst.l parm2(a5)
- beq.s .B
- bsr echoz
- bsr pr_lf
- move.l parm2(a5),a0
- lea prompt_args(a5),a2
- lea 1(a2),a1
- moveq #-1,d0
- .A addq.b #1,d0
- move.b (a0)+,(a1)+
- bne.s .A
- .C move.b d0,(a2)
- MOVEQ #RETURN_OK,D0
- rts
- .B lea prompt_args+1(a5),a1
- bsr pr_stringlf
- moveq #RETURN_OK,d0
- rts
-
- **************
- compose_prompt
- lea prompt_string(a5),a1
- move.l a1,prompt_cr(a5)
- lea farb3(pc),a0
- .C move.b (a0)+,(a1)+ copy highlight colour
- bne.s .C
- move.b #15,-1(a1) no-confuse-char
- lea prompt_args+1(a5),a0
- cpro3 move.b (a0)+,d0
- beq composer3
- cmp.b #$5c,d0 ;\
- bne.s .A
- move.b (a0)+,d0
- bra composer2
- .A cmp.b #'%',d0
- bne composer2
- move.b (a0)+,d0
- bset #5,d0
- cmp.b #'p',d0 check if %p
- bne.s try_halfcd
- lea CD_string+1(a5),a2
- .B move.b (a2)+,(a1)+ copy cd_string to prompt_string
- bne.s .B
- lea -1(a1),a1
- bra cpro3
- try_halfcd
- cmp.b #'s',d0 check if %s
- bne.s try_line_num
- lea CD_string+1(a5),a2
- move.l a2,d1
- .A tst.b (a2)+
- bne.s .A
- subq.l #2,a2
- bra.s .D
- .C move.b -(a2),d0
- .D cmp.l a2,d1
- bhi.s .E
- cmp.b #"/",d0
- beq.s .E
- cmp.b #":",d0
- bne.s .C
- .E addq.l #1,a2
- .B move.b (a2)+,(a1)+ copy cd_string to prompt_string
- bne.s .B
- lea -1(a1),a1
- bra cpro3
- try_line_num
- cmp.b #'l',d0 check if %l
- bne.s try_oldcmd
- move.l count_line(a5),d0
- moveq #0,d1
- move.l a1,a2
- bsr qdecpr insert current line number
- move.l a2,a1
- bra cpro3
- try_oldcmd
- cmp.b #'c',d0 check if %c
- bne.s try_task_num
- lea shelline(a5),a2
- .B move.b (a2)+,(a1)+
- bne.s .B
- lea -1(a1),a1
- bra cpro3
- try_task_num
- cmp.b #'n',d0 check if %n
- bne.s composer2
- move.l thistask(a5),a2
- move.l pr_TaskNum(a2),d0
- add.b #$30,d0
- composer2 move.b d0,(a1)+
- cmp.b #LF,d0
- bne.s .A
- move.l a1,prompt_cr(a5)
- .A bra cpro3
- composer3 lea farb1(pc),a0
- .A move.b (a0)+,(a1)+
- bne.s .A
- rts
-
-
- *FILL FIB WITH EXAMINE A0-> directory name ,D7=filelock on return
- fibexam move.l a0,-(sp)
- moveq #ACCESS_READ,d2
- move.l a0,d1
- jsr _LVOLock(a6)
- move.l d0,d7
- beq DOSerr
- bsr fibexam2
- move.l (sp)+,a0
- rts
- fibexam2
- move.l d0,d1
- move.l a5,d2
- jsr _LVOExamine(a6)
- tst.l d0
- beq DOSerrUL
- rts
-
- *****************
- * CD *
- *****************
- cdz tst.l parm2(a5)
- beq querycd
- move.l parm2(a5),a0
- *CHANGE DIRECTORY A0-> new current directory
- bsr fibexam
- tst.l fib_DirEntryType(a5) ;check entry OK
- bpl.s .A
- lea cderrtx(pc),a1
- bsr pr_string
- move.l d7,d1
- jsr _LVOUnLock(a6)
- moveq #RETURN_ERROR,d0
- rts
- .A move.l d7,d1
- chdir move.l d1,a0
- add.l a0,a0
- add.l a0,a0
- move.l thistask(a5),a1
- move.l fl_Task(a0),pr_FileSystemTask(a1)
- jsr _LVOCurrentDir(a6)
- move.l cdback(a5),d1
- move.l d0,cdback(a5) remember old directory
- jsr _LVOUnLock(a6) unlock the old directory
- bsr eval_CD update cd string
- moveq #RETURN_OK,d0
- rts
-
- querycd bsr eval_CD
- lea CD_string+1(a5),a1
- bsr pr_stringlf
- moveq #RETURN_OK,d0
- rts
-
-
- ** Evaluate entire name of current directory and put in CD_string
- eval_CD clr.b CD_string+1(a5)
- lea null(pc),a0
- move.l a0,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq.s .A
- move.l d0,a0
- add.l a0,a0
- add.l a0,a0
- move.l fl_Key(a0),cd_block(a5)
- move.l fl_Volume(a0),cd_volnode(a5)
- lea CD_string+1(a5),a0
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- .A moveq #-1,d0
- lea CD_string(a5),a0
- lea 1(a0),a1
- .B addq.b #1,d0
- tst.b (a1)+
- bne.s .B
- move.b d0,(a0)
- rts
-
- ** evaluate entire name associated with lock in D0, store string in A0
- ** Return D1 = last lock to unlock
- ** Reg usage: d0,d1,d2,d3,a0,a1,a3 (must not use A2)
- eval_full_path
- move.b #"?",(a0)
- clr.b 1(a0)
- move.l d0,d1
- beq.s .C
- lsl.l #2,d0
- move.l d0,a1
- moveq #ACCESS_READ,d0
- cmp.l fl_Access(a1),d0 only eval read locks
- bne.s .B
- .C cmp.w #36,kickver(a5)
- blo.s .A
- move.l d1,a3
- move.l a0,d2
- moveq #78,d3
- jsr _LVONameFromLock(a6)
- move.l a3,d1
- .B rts
- .A lea -88(sp),sp
- move.l a0,4(sp) save address of string
- move.l d1,(sp) save original lock on stack
- move.l a5,d2
- jsr _LVOExamine(a6)
- move.l 4(sp),a1
- lea fib_FileName(a5),a0
- evx1 move.b (a0)+,(a1)+ COPY FILENAME TO deststring
- bne.s evx1
- lea -1(a1),a3
- evcd2 move.l (sp),d1 get lock
- jsr _LVOParentDir(a6)
- tst.l d0
- beq.s root_found
- move.l (sp),d1
- move.l d0,(sp)
- jsr _LVOUnLock(a6) unlock last
- move.l (sp),d1
- move.l a5,d2
- jsr _LVOExamine(a6)
- lea fib_FileName(a5),a0
- lea 8(sp),a1
- evx2 move.b (a0)+,(a1)+ stackbuf = filename
- bne.s evx2
- move.b #'/',-1(a1)
- move.l 4(sp),a0
- evx3 move.b (a0)+,(a1)+ stackbuf = filename/CD_string
- bne.s evx3
- move.l 4(sp),a1
- lea 8(sp),a0
- evx4 move.b (a0)+,d0
- move.b d0,(a1)+
- cmp.b #'/',d0
- bne.s evx4
- lea -1(a1),a3
- evx5 move.b (a0)+,(a1)+ dest string = stackbuf
- bne.s evx5
- bra evcd2
- root_found
- move.l (sp),d1
- tst.b (a3)
- bne.s root2
- clr.b 1(a3)
- root2 move.b #':',(a3)
- lea 88(sp),sp
- rts
-
- *ADDPATH A0-> path A1-> parameter A2-> destination for string
- ** eg. (A0)='df0:libs',0 (A1)='arp.library',0 (A2)='df0:libs/arp.library',0
- addpath movem.l a0-a2,-(sp)
- move.b (a0),d0
- beq.s addp4
- addp1 move.b (a0)+,d0
- beq.s addp2
- move.b d0,(a2)+
- bra.s addp1
- addp2 move.b -2(a0),d0
- cmp.b #':',d0
- beq.s addp4
- cmp.b #'/',d0
- beq.s addp4
- move.b #'/',(a2)+
- addp4 move.l a1,a0
- move.l a2,a1
- bsr cp_string
- movem.l (sp)+,a0-a2
- rts
-
-
- * Search Resident list for command V2.0:Global resi's
- * RETURN D0=seglist OR 0 if not found
- * A0=addr of node D2=addr of Vorgänger
- search_res move.l parm1(a5),a4
- search_res2
- bsr resi_hand
- beq.s .D
- move.l a0,d2
- .A lsl.l #2,d0
- move.l a4,a1 string
- move.l d0,a2
- lea resi_name(a2),a0 BSTR
- moveq #0,d3
- move.b (a0)+,d3
- subq.w #1,d3
- .B move.b (a0)+,d0
- move.b (a1)+,d1
- cmp.b ctrl_codes+15(a5),d1
- bne.s .F
- tst.b (a1)
- beq.s .C
- .F bsr compD1D0nocase
- dbne d3,.B
- bne.s .E not equal
- tst.b (a1)
- beq.s .C the (null-)END
- .E move.l a2,d2
- move.l resi_link(a2),d0 get link
- bne.s .A
- .D moveq #0,d0
- rts
- .C moveq #-1,d1
- cmp.l resi_usecount(a2),d1 is it a system-resi ?
- beq.s .D
- move.l resi_seglist(a2),d0 get seglist
- move.l a2,a0
- rts
-
-
- *Search paths for command
- *Exit: d0=seglist, d4=PROGDIR:, branches if script file
- spaths move.l parm1(a5),a4 A4=parm1
- spaths2 moveq #0,d4 jump-in for resident,do not load scripts with it!
- move.l thistask(a5),a3
- lea pr_CurrentDir(a3),a3 (A3)=ptr to current dir
- move.l (a3),d3 d3=current dir at beginning
- move.l d3,d4 d4=PROGDIR:
- bsr lock_or_load
- tst.l d0
- bne gotit
- tst.l d7
- beq.s .C
- tst.b forcediskflag(a5)
- bne.s .D do not change dir
- tst.l fib_DirEntryType(a5) is it a DIR ?
- bmi.s .D no !
- addq.l #4,sp return from archie3
- move.l a4,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6) change current dir
- move.l d0,d1
- bra chdir
- .D bsr s_flagset exec script ?
-
- .C move.l a4,a0
- .F move.b (a0)+,d0 are there path-specific chars in the name
- cmp.b #"/",d0
- beq.s no_more_paths
- cmp.b #":",d0
- beq.s no_more_paths
- tst.b d0
- bne.s .F
- moveq #-1,d1
- bsr changeWindowPtr no requesters
- move.l CLIptr(a5),a2
- lea cli_CommandDir(a2),a2 A2=ptr to current path
-
- .A move.l (a2),d0 search all paths
- beq.s .B
- lsl.l #2,d0
- move.l d0,a2
- move.l 4(a2),d4 d4=PROGDIR:
- beq.s .A
- move.l d4,(a3)
- bsr lock_or_load disk access
- tst.l d0
- bne.s gotit
- tst.l d7
- beq.s .A
- tst.l fib_DirEntryType(a5) is it a DIR ?
- bpl.s .A
- bsr s_flagset exec script
- bra.s .A
- .B lea pathc(pc),a0
- move.l a0,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- move.l d0,d4
- beq.s no_more_paths
- move.l d4,(a3)
- move.l d4,closecdir(a5)
- bsr lock_or_load look in C: dir
- tst.l d0
- bne.s gotit
- no_more_paths
- moveq #0,d0
- gotit move.l d3,(a3) restore current dir
- moveq #0,d1 requesters on
- bra changeWindowPtr
-
- lock_or_load
- move.l a4,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- beq.s .A
- bsr fibexam2
- tst.l fib_DirEntryType(a5)
- bpl.s .C
- move.l fib_Protection(a5),d0
- btst #6,d0 script-bit ?
- bne.s .C
- btst #1,d0 not-execute-bit ?
- bne.s .C
- move.l a4,d1
- jsr _LVOLoadSeg(a6)
- tst.l d0
- bne.s .B
- move.l d7,d1
- jsr _LVOUnLock(a6)
- .A moveq #0,d0 file not found
- rts
- .C moveq #0,d0 file is a script or dir
- .B move.l d0,-(sp) file is executable
- move.l d7,d1
- jsr _LVOUnLock(a6)
- move.l (sp)+,d0
- rts
-
- s_flagset
- move.l fib_Protection(a5),d1
- btst #6,d1
- beq.s .A
- move.l a4,a0 A4 pts to filename
- bsr readfile
- move.l d3,(a3) restore current dir
- addq.l #8,sp kill return addresses (archie3,spaths,s_flagset)
- addq.l #4,sp
- bra xz3
- .A move.l #305,d0
- btst #1,d1
- bne pr_galactic not-execute-bit
- rts
-
- * ARCHIE 3 calls system0 to execute non internal commands
- archie3 tst.l parm1(a5) exit if nothing typed
- beq noarch31
- bsr save_mem
- clr.b resi_flag(a5) =0 if resident
- bsr search_res search resident list first
- tst.l d0
- bne.s .A
- addq.b #1,resi_flag(a5) =1 if not resident
- bsr spaths load the command
- tst.l d0
- beq noarch32 could not load
- cmp.w #36,kickver(a5)
- blo.s .A
- move.l thistask(a5),a3
- move.l d4,pr_HomeDir(a3) init PROGDIR:
- .A move.l d0,temp1(a5) save the segment
- bsr raw_off
- bsr save_time
- lea CLIbuf(a5),a0
- move.l a0,-(sp) push arg_args ptr.
- move.l d0,-(sp) push seglist
- move.l parm1(a5),d0
- move.l d0,-(sp) push arg_name
- bsr _System0 TAKES 3 PARMS(ARG_NAME,SEGLIST,ARGS)
- lea 12(sp),sp
- move.l d0,-(sp)
- cmp.w #36,kickver(a5)
- blo.s .G
- move.l thistask(a5),a3
- clr.l pr_HomeDir(a3) reset PROGDIR:
- move.l closecdir(a5),d1
- beq.s .G
- jsr _LVOUnLock(a6)
- clr.l closecdir(a5)
- .G jsr _LVOIoErr(a6)
- move.l d0,Result2(a5)
- tst.b resi_flag(a5)
- beq.s .B
- move.l better_Seglist(a5),d1
- jsr _LVOUnLoadSeg(a6)
- .B btst #FLcheck,Flags+3(a5)
- beq.s .C
- bsr show_status
- .C bsr raw_on
- move.l (sp)+,d2 RESULT IN D2
- beq.s .D
- btst #FLerrors,Flags+3(a5)
- beq.s .D
- move.l Result2(a5),d0
- beq.s .D
- bsr pr_DOSerr if result > 0 print error
- .D move.l d2,d0
- noarch31 rts
- noarch32
- move.l closecdir(a5),d1 command not found
- beq.s .G
- jsr _LVOUnLock(a6)
- clr.l closecdir(a5)
- .G lea badcomm(pc),a1
- moveq #RETURN_BAD,d0 return d0 bad
- bra pr_string
-
-
- ***** SYSTEM0 execute command from disk from Sozobon C distribution.
- _System0
- movem.l d2-d3/a2-a6,-(sp) ;SAVED_REGS
- moveq #NO_CLI,REG_Result ;#-1,d3 ERROR - not a CLI task
- move.l 4.w,REG_SysBase ;4,a6
- move.l thistask(a5),REG_Process ;a2
- move.l pr_CLI(REG_Process),d0
- beq quit0
-
- * build local stack frame & save some values
- lsl.l #2,d0
- move.l d0,REG_CLI ;a3
- move.l sp,REG_PrevStack ;a1 save old stack pointer
- move.l sp,d0
- and.b #$fc,d0 ;make SP longword-aligned for BPTRs
- move.l d0,sp
- sub.l #sf_SIZEOF,sp ;stack-frame-struct
- move.l REG_PrevStack,sf_PrevStack(sp)
- move.l REG_Process,sf_Process(sp)
- move.l REG_CLI,sf_CLI(sp)
- move.l pr_ReturnAddr(REG_Process),sf_SaveReturnAddr(sp)
-
- * allocate space for stack
- moveq #NO_MEM,REG_Result ;ERROR - no memory for STACK
- move.l cli_DefaultStack(REG_CLI),d0 ;in longwords for "VEC"
- lsl.l #2,d0
- move.l d0,sf_PushSize(sp)
- addq.l #4,d0 ;one additional longword
- move.l d0,sf_StackSize(sp)
- moveq #1,d1 ;intentionally NOT "MEMF_PUBLIC"!; V2.0 Why not ?
- callsys AllocMem
- tst.l d0
- beq quit1
- move.l d0,sf_StackBase(sp) ;save result
-
- * save old command pointer, build new BCPL command name
- move.l cli_CommandName(REG_CLI),sf_SaveCommandName(sp)
- move.l sf_PrevStack(sp),REG_PrevStack
- move.l ARG_NAME(REG_PrevStack),a0 ;first parameter to "System0()"
- lea sf_CommandName(sp),a1 ;BSTR
- move.w #MAXBSTR-2,d0
- bsr cpBSTR
- move.l d0,cli_CommandName(REG_CLI)
- * save contents of Current Input Stream
- move.l pr_CIS(REG_Process),d0
- lsl.l #2,d0
- move.l d0,REG_CIS
- move.l REG_CIS,sf_CIS(sp)
- move.l fh_Buf(REG_CIS),sf_SCB_Buf(sp)
- move.l fh_Pos(REG_CIS),sf_SCB_Pos(sp)
- move.l fh_End(REG_CIS),sf_SCB_End(sp)
-
- * convert argument to LF-terminated string
- move.l sf_PrevStack(sp),REG_PrevStack
- move.l ARG_ARGS(REG_PrevStack),a0 ;third argument to "System0()"
- lea sf_CommandArgs(sp),a1 ;first buffer location
- move.l a1,d0
- lsr.l #2,d0
- move.l d0,fh_Buf(REG_CIS)
- move.w #MAXBSTR-1,d0 ;leave some room for terminating LF
- bra.s .D
- .C move.b d1,(a1)+
- .D move.b (a0)+,d1
- dbeq d0,.C
- move.b #LF,(a1)
- move.l sf_PrevStack(sp),REG_PrevStack
- sub.l ARG_ARGS(REG_PrevStack),a0 ;subtract first position
- move.l a0,d0 ;do NOT subtract 1, LF need this byte
- * setup start/end indices in Stream Control Block
- clr.l fh_Pos(REG_CIS)
- move.l d0,fh_End(REG_CIS)
-
- * misc setup
- clr.l pr_Result2(REG_Process) ;clear secondary result
- move.l a5,sf_Membase(sp) ;save membase
- ; moveq #0,d0
- ; moveq #0,d1
- ; bset #SIGBREAKB_CTRL_C,d1
- ; callsys SetSignal ;clear CTRL-C flag
-
- * handle seglist and start address
- move.l cli_Module(REG_CLI),sf_SaveModule(sp)
- move.l sf_PrevStack(sp),REG_PrevStack
- move.l ARG_SEGLIST(REG_PrevStack),d0 ;second argument to "System0()"
- move.l d0,cli_Module(REG_CLI)
- lsl.l #2,d0
- move.l d0,a3
- * setup processor registers & C-interface
- lea sf_CommandArgs(sp),a0
- move.l fh_End(REG_CIS),d0
- * setup processor registers, BCPL-interface, stack & return address for "Exit()"
- move.l sf_StackBase(sp),a1 ;BCPL stack, low end
- move.l sf_PushSize(sp),d2
- lea 4(a1,d2.l),a4 ;must not destroy REG_Process!
- move.l sp,-(a4) ;previous stack frame
- move.l d2,-(a4) :stack size in bytes
- move.l a4,pr_ReturnAddr(REG_Process)
- move.l a4,sp
- move.l dosbase(a5),a4 ;V2.0 small data
- movem.l dl_A2(a4),a2/a5/a6
-
- * now call the command at its entry point
- jsr 4(a3) ;code starts one longword behind segment pointer
- move.l d0,REG_Result ;save return code
-
- * get old stackframe & reload old register contents
- move.l 4(sp),sp ;old stack frame
- move.l sf_Membase(sp),a5
- move.l sf_Process(sp),a0
- move.l sf_SaveReturnAddr(sp),pr_ReturnAddr(a0)
- move.l sf_CIS(sp),d0
- move.l d0,a1
- lsr.l #2,d0
- move.l d0,pr_CIS(a0) ;V2.0 restore CIS
- move.l sf_CLI(sp),a0
- move.l sf_SaveCommandName(sp),cli_CommandName(a0)
- * Next line makes powerpacker programs deallocate memory properly
- move.l cli_Module(a0),better_Seglist(a5) ;V2.0 small data
- move.l sf_SaveModule(sp),cli_Module(a0)
- * restore original contents of Current Input Stream
- move.l sf_CIS(sp),a0
- lea sf_CommandArgs(sp),a1
- move.l a1,d0
- lsr.l #2,d0
- cmp.l fh_Buf(a0),d0 ;still the same?
- bne.s .E ;no: don't restore
- move.l sf_SCB_Buf(sp),fh_Buf(a0)
- .E move.l sf_SCB_Pos(sp),fh_Pos(a0)
- tst.l fh_End(a0) ;end index set?
- beq.s .F ;no: don't restore
- move.l sf_SCB_End(sp),fh_End(a0)
-
- * free temporary stack
- .F move.l 4.w,REG_SysBase
- move.l sf_StackBase(sp),a1
- move.l sf_StackSize(sp),d0
- callsys FreeMem
-
- quit1 move.l sf_PrevStack(sp),sp ;UNLINK local variables
- quit0 move.l REG_Result,d0
- movem.l (sp)+,d2-d3/a2-a6 ;SAVED_REGS
- quitx rts
-
-
- *************************
- * HELP *
- *************************
- helpz bsr rawh_off
- move.l parm2(a5),d7
- bne help_man
- lea helptx1(pc),a1
- bsr pr_stringlf
- lea comtext(pc),a4
- lea tempbuf(a5),a3
- .D moveq #5,d3
- .C move.l a3,a2
- tst.b (a4)
- beq .E
- moveq #12,d2
- .B subq.l #1,d2
- move.b (a4)+,(a2)+
- bne.s .B
- tst.b -(a2) bump back
- .A move.b #$20,(a2)+
- dbra d2,.A
- clr.b (a2)
- move.l a3,a1
- bsr pr_string
- dbra d3,.C
- bsr pr_lf
- bra .D
- .E bsr pr_lf
- lea helptx2(pc),a4
- lea helptx3(pc),a0
- move.l a0,d6
- bsr pr_screen
- moveq #RETURN_OK,D0
- rts
-
- * print out part of manual, d7 points to topic
- help_man lea manadr(pc),a2 global variable
- move.l 4(a2),d1
- move.l (a2),d0
- bne.s .A
- lea helpload(pc),a1
- bsr pr_string
- lea helpman(pc),a0
- bsr readfile load manual
- move.l d0,(a2) manadr
- move.l d1,4(a2) mansize
- .A move.l d0,a3
- move.l d1,d5
- add.l a3,d5
- move.l a3,a2
- move.l d7,a1 type all ?
- moveq #0,d4
- cmp.b #"?",(a1)
- beq make_screen type all !
- .B move.l d7,a1
- move.l d5,a0
- addq.l #1,a2
- bsr searchSTR search topic in manual
- cmp.b #LF,d0
- bne.s .C
- cmp.b #"-",-2(a2) there must be a lot of "-" before topic
- bne.s .B
- cmp.b #"-",-3(a2)
- bne.s .B
- move.l a1,d4
- .E bsr check_c ctrl-c ?
- bne.s .C
- .D cmp.l d5,a1
- bhi.s .C
- cmp.b #LF,(a1)+ print lines separately
- bne.s .D
- move.l d4,d2
- move.l a1,d3
- sub.l d2,d3
- move.l a1,d4
- move.l outhandle(a5),d1
- jsr _LVOWrite(a6)
- move.l d4,a1
- cmp.b #"-",-2(a1) search next lot of "-"
- bne.s .E
- cmp.b #"-",-3(a1)
- bne.s .E
- bra.s .B another fitting topic ?
- .C moveq #RETURN_OK,D0
- rts
-
- giveman movem.l d0/d1/a0/a1,-(sp) free manual-memory
- lea manadr(pc),a0
- tst.l (a0)
- beq.s .A
- move.l (a0),a1
- clr.l (a0)
- move.l 4(a0),d0
- bsr givemem
- .A movem.l (sp)+,d0/d1/a0/a1
- rts
-
-
- * PRINT A STRING BUT PUT A LINEFEED AFTER IT
- pr_stringlf bsr pr_string
- bra pr_lf
-
- *****************
- * PATH * Assign path or show it.
- *****************
- pathz lea parm2(a5),a3
- move.l (a3),d0 see whether any parameters
- beq ShowPaths
- move.l CLIptr(a5),a4
- lea cli_CommandDir(a4),a4
- move.l d0,a0
- bsr return_dash_option
- cmp.b #"C",d0
- bne.s .F
- bsr DeletePaths * remove all paths
- addq.l #4,a3
-
- .F moveq #-1,d3 reverse order
- .G addq.l #1,d3
- tst.l (a3)+
- bne.s .G
- subq.l #4,a3
- bra.s .D
- .C move.l -(a3),d1
- moveq #ACCESS_READ,d2 * add as many paths as given
- jsr _LVOLock(a6) get a lock
- move.l d0,d2
- beq DOSerr
- bsr CreatePath
- beq resi_no_mem
- .D dbra d3,.C
- moveq #RETURN_OK,d0
- rts
-
- DeletePaths ;a4=cli_CommandDir, removes all paths
- move.l a2,-(sp)
- move.l a4,a2
- .A move.l (a2),d0
- beq.s .B
- lsl.l #2,d0
- move.l d0,a2
- move.l 4(a2),d1
- beq.s .A
- jsr _LVOUnLock(a6) unlock all paths
- bra.s .A
- .B move.l (a4),d1
- beq.s .E
- jsr _LVOUnLoadSeg(a6) free memory
- tst.l d0
- beq DOSerr
- clr.l (a4) set path ptr to nil
- .E move.l (sp)+,a2
- rts
-
- CreatePath ;d2=Lock, a4=cli_CommandDir
- moveq #12,d0
- moveq #1,d1
- bsr iwantmem create seglist
- beq.s .A
- move.l d0,a0
- addq.l #4,d0
- lsr.l #2,d0
- moveq #12,d1
- move.l d1,(a0) size of seglist
- move.l (a4),4(a0) link the new path
- move.l d2,8(a0) bptr to lock
- move.l d0,(a4) first in path-list
- .A rts
-
- ShowPaths
- bsr rawh_off
- lea pcurrent(pc),a1
- bsr pr_stringlf
- move.l CLIptr(a5),a0
- lea cli_CommandDir(a0),a2
- .A move.l (a2),d0
- beq.s .B
- lsl.l #2,d0
- move.l d0,a2
- move.l 4(a2),d1
- beq.s .A
- jsr _LVODupLock(a6)
- tst.l d0
- beq.s .A
- lea tempbuf(a5),a0
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- lea tempbuf(a5),a1
- bsr pr_stringlf
- bra.s .A
- .B lea pathc(pc),a1
- bsr pr_stringlf
- moveq #RETURN_OK,d0
- rts
-
- CopyPaths ;copy paths from task in a0 to this task
- movem.l d2-d3/a2-a4,-(sp)
- move.l thistask(a5),a4
- move.l pr_CLI(a4),d0
- beq.s .D
- lsl.l #2,d0
- move.l d0,a4
- lea cli_CommandDir(a4),a4
- move.l pr_CLI(a0),d0
- beq.s .D
- lsl.l #2,d0
- move.l d0,a0
- lea cli_CommandDir(a0),a2
- lea tempbuf(a5),a3
- moveq #0,d3
- .A move.l (a2),d0 * walk through all paths
- beq.s .C
- lsl.l #2,d0
- move.l d0,a2
- move.l 4(a2),d1
- beq.s .A
- move.l d1,(a3)+
- addq.l #1,d3
- bra.s .A
- .B move.l -(a3),d1
- jsr _LVODupLock(a6) copy lock
- move.l d0,d2
- beq.s .C
- bsr CreatePath add path
- .C dbra d3,.B
- .D movem.l (sp)+,d2-d3/a2-a4 return
- rts
-
- *****************
- * INFO *
- *****************
- infoz bsr rawh_off ;V2.0 (fully new)
- lea inform_tx(pc),a1
- bsr pr_stringlf
- move.l $22(a6),a0 ;rootnode
- move.l $18(a0),a0 ;dosinfo
- add.l a0,a0
- add.l a0,a0
- move.l 4(a0),d6 ;devicelist
- jajo tst.l d6
- bne .B
- moveq #RETURN_OK,d0
- rts
-
- .B lsl.l #2,d6 ;BPTR
- move.l d6,a4
- move.l (a4),d6 ;next
- tst.l 4(a4) ;type
- bne.s jajo ;was volume or assign
- tst.l 8(a4) ;task
- beq.s jajo ;was non-disk-device
- didev move.l $28(a4),a0 ;name
- add.l a0,a0
- add.l a0,a0
- moveq #0,d0
- move.b (a0)+,d0
- lea tempbuf(a5),a3
- move.l a3,a2
- bra.s .D
- .C move.b (a0)+,(a2)+
- .D dbra d0,.C
- move.b #":",(a2)+
- clr.b (a2)
- move.l 8(a4),packettask(a5) ;aptr task
- bsr GetDiskInfo
- bsr PKTerr
- bsr do_forbid
- move.l id_DiskType(a5),d0
- move.l d0,d1
- clr.b d1
- cmp.l #"DOS"<<8,d1
- beq.s itsDos ;DOS-Disk
- lea nodisk+1(pc),a0
- moveq #-1,d1
- cmp.l d1,d0
- beq.s .F
- lea baddisk(pc),a0
- cmp.l #"BAD"<<8,d0
- beq.s .F
- lea nodos+1(pc),a0
- cmp.l #"NDOS",d0
- beq.s .F
- lea kickdisk(pc),a0
- cmp.l #"KICK",d0
- beq.s .F
- lea inhidisk(pc),a0
- .F move.l a0,-(sp)
- move.l id_UnitNumber(a5),-(sp)
- move.l a3,-(sp)
- bsr do_permit
- lea (sp),a1
- lea inform2(pc),a0
- bsr new_print
- lea 12(sp),sp
- bra jajo
-
- itsDos move.l id_VolumeNode(a5),a0 ;DOS-Disk
- add.l a0,a0
- add.l a0,a0
- move.l $28(a0),a0 ;name (hope, it is NULL-ending)
- add.l a0,a0
- add.l a0,a0
- addq.l #1,a0
- move.l a0,-(sp)
- move.l id_NumSoftErrors(a5),-(sp) ;SoftErrors
- move.l id_DiskState(a5),d0
- lea statro(pc),a0
- moveq #80,d1
- cmp.l d1,d0
- beq.s .H
- lea statrw(pc),a0
- moveq #82,d1
- cmp.l d1,d0
- beq.s .H
- lea statval(pc),a0
- moveq #81,d1
- cmp.l d1,d0
- beq.s .H
- lea statun(pc),a0
- .H move.l a0,-(sp) ;Status
- move.l id_BytesPerBlock(a5),d1
- move.l d1,-(sp) ;BlockSize
- move.l id_NumBlocks(a5),d0
- bsr mult_32x32
- lsr.l #8,d0
- lsr.l #2,d0
- move.l d0,d2
- move.l id_NumBlocksUsed(a5),d0
- bsr mult_32x32
- lsr.l #8,d0
- lsr.l #2,d0
- move.l d2,d3
- sub.l d0,d3
- moveq #100,d1
- bsr mult_32x32
- move.l d2,d1
- beq.s .D
- bsr div_32 ;%
- .D exg d0,d2
- move.l d3,d1
- movem.l d0-d2,-(sp) ;Sizes
- lea msd_tx(pc),a0 messydos ?
- move.l $1c(a4),d0 dn_Startup
- moveq #2,d1
- cmp.l d1,d0
- bls.s .A
- lsl.l #2,d0
- move.l d0,a1
- move.l 8(a1),d0 fssm_Environ
- beq.s .A
- lsl.l #2,d0
- move.l d0,a1
- move.l 64(a1),d0 de_DosType
- cmp.l #"MSD"<<8,d0 CrossDos ?
- beq.s .C
- .A move.l id_DiskType(a5),d0
- lea quest_tx(pc),a0
- cmp.b #5,d0
- bhi.s .C unknown
- ext.w d0
- ext.l d0
- lea ofs_tx(pc),a0
- lsl.l #2,d0
- add.l d0,a0 d0*4+a0 access table
- .C move.l a0,-(sp) ;System
- move.l id_UnitNumber(a5),-(sp) ;Unit
- move.l a3,-(sp) ;Name
- bsr do_permit
- lea (sp),a1
- lea inform(pc),a0
- bsr new_print
- lea 40(sp),sp
- bra jajo
-
-
-
- *****************
- * ENDCLI * EXIT FROM ZSHELL TO CLI.
- ***************** IF WE EXIT FROM SCRIPT THEN FREE SCRIPT MEMORY
- endcliz bsr raw_off
- move.l parm2(a5),a0
- bsr return_dash_option
- moveq #-1,d7
- cmp.b #'C',d0
- bne.s .A
- moveq #0,d7
- .A tst.b scflag(a5)
- beq.s byebye
- bsr kill_script
- byebye move.l (sp)+,d0 ;kill return address on stack
- rts
-
- ** CHECK DIRECTORY DESCRIPTION IN (A0) AND CONVERTS INTO DIRNAME[0] AND PUTS
- ** THE WILD CARD IN WILD_STRING. ALSO SETS WILD_FLAG
- handle_wild_dirs
- clr.b wild_flag(a5)
- btst #FLwild,Flags+3(a5)
- beq.s .B
- cmp.w #37,kickver(a5)
- blo.s .B
- movem.l d2-d3/a0,-(sp)
- lea tempbuf(a5),a1
- move.l a1,d1
- bsr rempath
- lea NewPrintBuffer(a5),a0
- move.l a0,d2
- moveq #120,d3
- jsr _LVOParsePatternNC(a6) external matcher
- movem.l (sp)+,d2-d3/a0
- tst.l d0
- bmi.s .A
- bne.s .C
- .B bsr check_wild internal matcher
- tst.b d0
- bne.s .A
- .C lea wild_string(a5),a1
- bsr split_wild
- move.b #1,wild_flag(a5)
- .A rts
-
- ** SPLIT STRING(A0) INTO DIRECTORY PATH AND WILDCARD DESCRIPTION
- ** NULL END THE PATH, AND MOVE THE WILDCARD TO (A1)
- * eg. ram:c/*.info -> ram:c0 + *.info0
- split_wild
- movem.l d0-d1/a0-a2,-(sp)
- move.l a0,d1
- sp_w2 move.l a0,a2 a2=temp
- sp_w3 move.b (a0)+,d0
- beq.s sp_w4
- cmp.b #':',d0
- beq.s sp_w2 A0= 1 after :
- cmp.b #'/',d0
- beq.s sp_w2
- bra.s sp_w3
- sp_w4 cmp.l a2,d1
- beq.s sp_mis
- cmp.b #':',-1(a2)
- bne.s sp_w5
- sp_mis move.l a2,d1 SAVE POSITION
- sp_w6 move.b (a2)+,(a1)+
- bne.s sp_w6
- move.l d1,a2
- clr.b (a2)
- movem.l (sp)+,d0-d1/a0-a2
- rts
- sp_w5 clr.b -1(a2)
- sp_w7 move.b (a2)+,(a1)+
- bne.s sp_w7
- movem.l (sp)+,d0-d1/a0-a2
- rts
-
- ** CHECK STRING(A0) IF IT CONTAINS WILDCARD SPECIFIC CHARS
- ** RETURN D0=0 IF WILDS FOUND
- check_wild ;only used by handle_wild_dirs
- move.l a0,-(sp)
- chk_w3 move.b (a0)+,d0
- beq.s chk_w2
- cmp.b #'*',d0
- beq.s chk_w4
- cmp.b #'~',d0 special not char
- beq.s chk_w4
- cmp.b #'[',d0
- beq.s chk_w4
- cmp.b #']',d0
- beq.s chk_w4
- cmp.b #'|',d0 or char
- beq.s chk_w4
- cmp.b #'?',d0
- bne.s chk_w3
- chk_w4 moveq #0,d0
- move.l (sp)+,a0
- rts
- chk_w2 moveq #1,d0
- move.l (sp)+,a0
- rts
-
- * NOTE this wildmatcher only handles cases where the wildcard has one * in it.
- ** WILDCARD MATCHER. CHECK IF STRING(A0) MATCHES WILDCARD(A1)
- ** RETURN D0=0 IF MATCH
- wildmatch2
- btst #FLwild,Flags+3(a5)
- beq.s wildmatch
- cmp.w #37,kickver(a5)
- blo.s wildmatch
- movem.l d2/a0/a1,-(sp)
- move.l a0,d2
- lea NewPrintBuffer(a5),a0
- move.l a0,d1
- jsr _LVOMatchPatternNC(a6) external matcher
- movem.l (sp)+,d2/a0/a1
- moveq #0,d1
- tst.l d0
- bne.s .A
- addq.l #1,d1
- .A move.l d1,d0
- rts
- wildmatch movem.l d2/a2-a3,-(sp)
- move.b (a1),d2
- cmp.b #"~",d2 ;check if all is negated
- bne.s .C
- addq.l #1,a1
- .C move.l a1,a2
- move.l a0,a3
- .A move.b (a2)+,d0
- beq.s .B
- cmp.b #"|",d0 ;or-symbol V2.0
- bne.s .A
- move.b #0,-1(a2) ;change wildcard to end
- bsr.s wildermatch
- move.b #"|",-1(a2) ;restore
- tst.l d0
- beq.s gut
- lea (a3),a0
- lea (a2),a1
- bra.s .A
- .B bsr.s wildermatch
- gut cmp.b #"~",d2
- bne.s .D
- subq.l #1,d0
- .D movem.l (sp)+,d2/a2-a3
- rts
-
- wildermatch
- cmp.b #'~',(a1) check for NOT specifier
- bne.s wm_1
- move.b (a1)+,d0
- bsr.s wm_1
- subq.l #1,d0 0 --> -1 1 --> 0
- rts
-
- wm_1 move.b (a0)+,d0
- beq source_fin1
- move.b (a1)+,d1
- cmp.b #'*',d1
- beq.s wild_run
- cmp.b #'[',d1 handle character classes
- bne.s .A
- .B move.b (a1)+,d1
- beq.s wild_fail
- cmp.b #']',d1
- beq.s wild_fail
- bsr compD1D0nocase
- bne.s .B
- .C move.b (a1)+,d1
- beq.s wild_fail
- cmp.b #']',d1
- bne.s .C
- bra.s wm_1
- .A cmp.b #'?',d1
- beq.s wm_1
- bsr compD1D0nocase
- beq.s wm_1
-
- wild_fail moveq #1,d0
- rts
- wild_run
- wr_3 tst.b (a0)+ GOTO END OF STRING
- bne.s wr_3
- wr_4 tst.b (a1)+ GOTO END OF WILDCARD
- bne.s wr_4
- wr_5 move.b -(a1),d0 get tail of wildcard (1st should be null)
- move.b -(a0),d1
- cmp.b #'*',d0
- beq.s source_fin2
- cmp.b #']',d0 handle class [xyz]
- bne.s .A
- .B move.b -(a1),d0
- cmp.b #'*',d0
- beq.s wild_fail
- cmp.b #'[',d0
- beq.s wild_fail
- bsr compD1D0nocase
- bne.s .B
- .C move.b -(a1),d0
- beq.s wild_fail should never happen but should leave in
- cmp.b #'[',d0
- bne.s .C
- bra.s wr_5
- .A cmp.b #'?',d0
- beq.s wr_5
- bsr compD1D0nocase
- beq.s wr_5
- bra.s wild_fail
- source_fin1
- tst.b (a1)
- beq.s source_fin2
- cmp.b #'*',(a1)
- bne.s wild_fail
- source_fin2
- moveq #0,d0
- rts
-
- compD1D0nocase ;lowercase d0 and d1 then compare them
- cmp.b #'Z',d1
- bhi.s D1_OK
- cmp.b #'A',d1
- blo.s D1_OK
- add.b #$20,d1
- D1_OK cmp.b #'Z',d0
- bhi.s D0_OK
- cmp.b #'A',d0
- blo.s D0_OK
- add.b #$20,d0
- D0_OK cmp.b d1,d0
- rts
-
- fibexnx move.l d7,d1
- move.l a5,d2
- jsr _LVOExNext(a6)
- rts
-
- *********************************
- * DIRECTORY LISTER *
- *********************************
- fname equ 40 for sorting
-
- dirz clr.l temp2(a5) WIDE DIR, 2 columns
- bset.l #31,temp2(a5) bit 31=wide flag
- bra.s directory
-
- listz clr.l temp2(a5) NARROW DIR, clear wide flag
- bset.l #29,temp2(a5) bit 29=verbose flag
- bset.l #28,temp2(a5) bit 28=comment flag
- directory ;V2.0:many things better (sort!)
- bsr check_q_r
- directory2
- lea parm2(a5),a2
- bsr rawh_off
- move.l (a2),d1
- bne.s .A
- lea null(pc),a0
- move.l a0,d1
- bra.s .B
-
- .A move.l (a2)+,d1 list all parms
- beq.s .C
- .B move.l a2,-(sp)
- move.l d1,a2
- bsr DirLister
- move.l (sp)+,a2
- tst.l d0
- bne.s .E
- tst.b break_flag(a5)
- beq.s .A
- .C moveq #RETURN_OK,d0
- .E rts
-
- DirLister ;wants dirname or filename in a2
- *temp2-bits: 31:wide dir: DIR
- * 30:quick, nosort: (all)
- * 29:verbose list: LIST
- * 28:comment: LIST
- * 27:footer: (auto)
- * 26:delete file: DELETE,MOVE
- * 25:not process file: DELETE,COPY,MOVE
- * 24:protect: PROTECT
- * 23:copy: COPY,MOVE
- * 22:move: MOVE
- * 21:rename: MOVE
- * 20:join: JOIN
- clr.l temp1(a5) init total size
- and.l #$fff00000,temp2(a5)
- clr.l temp3(a5)
- clr.l temp4(a5)
- bset #21,temp2+1(a5)
- btst.l #31,temp2(a5)
- beq.s .A
- bset #0,temp2+3(a5)
- .A btst.l #30,temp2(a5)
- beq.s .B
- bclr #28,temp2(a5)
- .B clr.w indent_count(a5)
- move.l a2,a0
- bsr handle_wild_dirs
- lea tempbuf(a5),a4
- .C move.b (a2)+,(a4)+
- bne.s .C
- bsr pr_dir -> print the dir
-
- pr_size movem.l d0-d3,-(sp) end of dirlister
- move.l temp2(a5),d0 are we printing wide
- bpl.s .B
- btst.l #0,d0
- bne.s .B
- bsr pr_lf print missing lf
- .B lea (sp),a1
- lea totsize(pc),a0
- btst #27,temp2(a5)
- beq.s .A
- bsr new_print print footer
- .A lea 16(sp),sp
- moveq #RETURN_OK,d0
- rts
-
- pr_dir bset #27,temp2(a5)
- bclr #25,temp2(a5)
- lea tempbuf(a5),a0
- bsr fibexam
- bsr fixsoftlink
- btst #24,temp2(a5) protect flag ?
- bne.s .D
- btst #26,temp2(a5) delete flag ?
- beq.s .B
- .D tst.b wild_flag(a5)
- beq.s .C
- .B tst.l fib_DirEntryType(a5) check entry OK
- bpl.s prd20 print whole Directory
-
- .C bsr check_c
- bne.s .F
- move.l d7,d1
- jsr _LVOUnLock(a6) unlock file
- lea tempbuf(a5),a0
- lea temp2buf(a5),a1
- bsr split_wild separate path and filename
- lea tempbuf(a5),a0
- move.l a0,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6) get a lock on the dir
- move.l d0,d7
- bsr pr_it print single file/dir
- bclr #27,temp2(a5) do not print footer
- .F bsr unlock make sure to unlock
- rts
-
- prd20 tst.w indent_count(a5) was a dir
- bne.s .A
- move.l d7,d1
- jsr _LVOUnLock(a6)
- lea tempbuf(a5),a0
- move.l a0,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- lea temp2buf(a5),a0 get full dir name for later
- clr.b (a0)
- tst.l d0
- beq DOSerr
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- lea dirof(pc),a1
- bsr pr_string
- lea temp2buf(a5),a1
- bsr pr_stringlf print directory's name
- lea tempbuf(a5),a0
- bsr fibexam
-
- .A sub.l a3,a3 ;clr a3
- prd2
- bsr check_c CTRL-C pressed ?
- bne unlk
- bsr fibexnx
- tst.l d0
- beq unlk ;sort ?
- bsr fixsoftlink
- move.l temp2(a5),d0
- btst #31,d0
- beq.s .C
- move.l fib_Protection(a5),d0
- btst #7,d0
- bne.s prd2 hide if hide flag is set in wide dir lister
- lea ignoreit(a5),a1 hide ctrl-ignore
- tst.b (a1)
- beq.s .C
- lea fib_FileName(a5),a0
- bsr wildmatch wildcheck
- tst.b d0
- beq.s prd2
- .C tst.b wild_flag(a5)
- beq.s dozel
- tst.b recurs_flag(a5)
- beq.s .A
- tst.l fib_DirEntryType(a5)
- bpl.s dozel
- .A lea fib_FileName(a5),a0
- lea wild_string(a5),a1
- bsr wildmatch2 wildcheck (can be external)
- tst.b d0
- bne.s prd2
- dozel btst.l #30,temp2(a5)
- beq.s collect not quick
- btst #26,temp2(a5)
- bne.s collect delete
- bsr zelma
- bra.s prd2
-
- collect moveq #fname,d0 collect files to sort V2.0
- lea fib_FileName(a5),a0
- lea (a0),a2
- .A addq.l #1,d0
- tst.b (a0)+
- bne.s .A
- lea fib_Comment(a5),a0
- .B addq.l #1,d0
- tst.b (a0)+
- bne.s .B
- moveq #1,d1
- bsr iwantmem
- beq unlock
- move.l d0,a0
- move.l a3,(a0)+
- lea -4(a0),a3
- lea fib_DiskKey(a5),a1 ;store fib in mem
- move.l (a1)+,(a0)+
- move.l (a1)+,(a0)+
- lea fib_Protection(a5),a1
- moveq #6,d1
- .C move.l (a1)+,(a0)+
- dbra d1,.C
- .D move.b (a2)+,(a0)+ ;name
- bne.s .D
- .E move.b (a1)+,(a0)+ ;comment
- bne.s .E
- bra prd2
-
- unlk btst.l #26,temp2(a5)
- bne.s .A delete
- btst.l #30,temp2(a5)
- bne unlock quick
- .A move.l a3,d0
- beq unlock no files
- tst.b break_flag(a5)
- bne.s nextfi CTRL-C pressed
-
- movem.l a4-a6,-(sp)
- btst.l #30,temp2(a5)
- bne.s snull quick
- lea (a3),a0 ;INSERTION SORT V2.0 (ooohuuooo)
- aussort lea (a3),a1
- move.l (a0),a2 ;remove (a0->) a2
- move.l a2,d0
- beq.s snull ;end of list
- move.l (a2),(a0)
- bsr strcmp ;compare a1 and a2
- bne.s insort ;insert a2 (old place)
- move.l a2,a3 ;a2->start
- move.l a1,(a2) ;a1=old start
- bra.s aussort ;next
- insort move.l a1,a4 ;reminder
- move.l (a1),a1 ;next a1
- cmp.l a0,a4
- beq.s inold
- shno bsr strcmp ;compare a1 and a2
- bne.s insort ;go on
- move.l a2,(a4) ;insert a2
- move.l a1,(a2) ;a4->a2->a1
- bra.s aussort
- inold move.l (a0),(a2) ;a2 back at old place
- move.l a2,(a0) ;a0->a2->next
- move.l a2,a0 ;next a0
- bra.s aussort
- snull movem.l (sp)+,a4-a6 ;FINISHED !!!
-
- tst.l temp2(a5) for normal DIR
- bpl.s nextfi
- tst.b recurs_flag(a5)
- bne.s nextfi
- moveq #1,d0 prepare for printing in 2 columns
- move.l a3,d1
- .A addq.l #1,d0
- move.l d1,a0
- move.l (a0),d1
- bne.s .A count number of entries (d0)
- lsr.l #1,d0 divide by two
- move.l a3,a2
- bra.s .B
- .C move.l a2,a0
- move.l (a2),a2
- .B dbra d0,.C find the middle (a2 ,precedor in a0)
- clr.l (a0)
-
- nextfi lea 4(a3),a1 print all files
- lea fib_DiskKey(a5),a0 ;restore fib from mem
- move.l (a1)+,(a0)+
- move.l (a1)+,(a0)+
- lea fib_Protection(a5),a0
- moveq #6,d1
- .F move.l (a1)+,(a0)+
- dbra d1,.F
- moveq #fname,d0
- lea fib_FileName(a5),a0
- .H addq.l #1,d0
- move.b (a1)+,(a0)+ ;name
- bne.s .H
- lea fib_Comment(a5),a0
- .B addq.l #1,d0
- move.b (a1)+,(a0)+ ;comment
- bne.s .B
- movem.l d0/a2/a3,-(sp)
- tst.b break_flag(a5)
- bne.s .C CTRL-C pressed
- bsr check_c
- bne.s .C
- bsr zelma
- .C movem.l (sp)+,d0/a2/a3
- move.l (a3),d2
- lea (a3),a1
- bsr givemem
- move.l d2,a3
- tst.l temp2(a5)
- bpl.s .A
- tst.b recurs_flag(a5)
- bne.s .A
- move.l a2,a0 swap lower and upper list
- move.l a3,a2
- move.l a0,a3
- .A move.l a3,d0 tst.l a3
- bne nextfi
-
- unlock move.l d7,d1
- jsr _LVOUnLock(a6)
- move.l temp1(a5),d0 ;total size
- move.l temp4(a5),d1
- move.l temp2(a5),d2 ;No. of files and dirs
- btst.l #31,d2
- beq.s .A
- subq.l #1,d2
- .A and.l #$000fffff,d2 ;1.000.000 files max. should be enough
- move.l temp3(a5),d3 ;No. of dirs
- sub.l d3,d2
- rts
-
- strcmp move.l 8(a1),d0
- move.l 8(a2),d1
- bmi.s .A
- tst.l d0 a2 is dir
- bpl.s .B a1 is dir too
- bra.s donoth a2:dir a1:file
- .A tst.l d0 a2 is file
- bpl.s inseit a2:file a1:dir
- .B lea fname(a1),a5 a1 is file too
- lea fname(a2),a6
- stcmp move.b (a5)+,d1 ;compare strings in a3 and a4
- beq.s donoth
- move.b (a6)+,d0
- beq.s inseit
- bsr compD1D0nocase
- beq.s stcmp
- bhi.s donoth
- inseit moveq #0,d0 ;insert it !
- rts
- donoth moveq #1,d0 ;do nothing !
- rts
-
-
- zelma tst.l fib_DirEntryType(a5)
- bpl.s .C
- bsr pr_it print file
- rts
- .C tst.b recurs_flag(a5)
- bne.s .B
- bsr pr_it print dir
- .A rts
- .B bset #25,temp2(a5) do not process this dir
- bsr pr_it print dir recursive
- bclr #25,temp2(a5)
- move.w temp2(a5),d0
- and.w #%0000010010010000,d0 copy,delete or join flag
- beq.s .D no
- btst #23,temp2+1(a5) copy ?
- beq.s .E
- move.l temp5(a5),d1 yes:create new dir
- bsr CurrentDir
- move.l d0,d3
- lea fib_FileName(a5),a2 copy: create dir
- move.l a2,d1
- jsr _LVOCreateDir(a6)
- move.l d0,d2
- bne.s .F
- .G move.l d3,d1
- bsr CurrentDir
- jsr _LVOIoErr(a6)
- move.l d0,d2
- bsr pr_lf
- move.l d2,d0
- bsr pr_DOSerr
- rts
- .F move.l d2,d1 unlock new dir, because is exclusive
- jsr _LVOUnLock(a6)
- move.l a2,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- move.l d0,d2
- beq.s .G
- move.l d3,d1
- bsr CurrentDir
- move.l temp5(a5),d1 unlock old in temp5
- jsr _LVOUnLock(a6)
- move.l d2,temp5(a5)
- lea makedirOK(pc),a1
- bsr pr_string
- bsr AdjustPath
- bra.s .D
- .E bsr pr_lf no copy: just print lf
-
- .D moveq #120,d0 ;(24bytes per recurs + subs + move-path)
- bsr stacktest
- bne .A
- move.l fib_DiskKey(a5),d0
- movem.l d0/d7/a4,-(sp)
- lea fib_FileName(a5),a0
- lea -1(a4),a4
- lea tempbuf(a5),a1
- cmp.l a1,a4
- beq.s jo
- cmp.b #":",-1(a4)
- beq.s jo
- move.b #"/",(a4)
- lea 1(a4),a4
- jo move.b (a0)+,(a4)+ ;addpath
- bne.s jo
- addq.w #2,indent_count(a5)
- jojo bsr pr_dir RECURSION V2.0
- subq.w #2,indent_count(a5)
- movem.l (sp)+,d0/d7/a4
- move.l d0,fib_DiskKey(a5) ;restore fib
- lea -1(a4),a0
- cmp.b #"/",(a0)
- bne.s .D
- clr.b (a0)
- lea 1(a0),a0
- .D lea (a0),a2
- lea fib_FileName(a5),a1
- je move.b (a0)+,(a1)+
- bne.s je
- clr.b (a2)
- moveq #2,d0
- move.l d0,fib_DirEntryType(a5)
- move.l d0,fib_EntryType(a5)
- moveq #0,d0
- move.l d0,fib_Size(a5)
- move.l d0,fib_NumBlocks(a5)
- btst #23,temp2+1(a5) copy ?
- beq.s .B
- move.l temp5(a5),d2 COPY
- move.l d2,d1
- jsr _LVOParentDir(a6)
- move.l d0,temp5(a5)
- move.l d2,d1
- jsr _LVOUnLock(a6)
- bsr AdjustPath
- .B btst #26,temp2(a5) delete ?
- beq.s .A
- move.l temp2(a5),-(sp)
- bclr #22,temp2+1(a5) move off
- bsr pr_it now delete this dir
- move.l (sp)+,temp2(a5)
- .A rts
-
- AdjustPath
- btst #22,temp2+1(a5)
- beq.s .D
- btst #21,temp2+1(a5)
- beq.s .D
- move.l temp5(a5),d1
- jsr _LVODupLock(a6)
- tst.l d0
- beq DOSerr
- move.l temp7(a5),a0
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- .D rts
-
- pr_it bsr num_spc print file or dir
- tst.l fib_DirEntryType(a5) check whether is dir
- bmi.s .A if plus,is directory
- move.l temp2(a5),d0 check for "DIR -R"
- bpl.s .G
- tst.b recurs_flag(a5)
- beq.s .G
- btst #0,d0
- bne.s .H
- subq.l #1,temp2(a5)
- bsr pr_lf for DIR -R directories
- .H addq.l #1,temp2(a5)
- .G lea farb3(pc),a1 change foregnd colour
- bsr addstring
- addq.l #1,temp3(a5) one dir more
- .A lea fib_FileName(a5),a1
- move.l a1,a0
- moveq #-1,d2
- add.w indent_count(a5),d2
- .B addq #1,d2
- tst.b (a0)+
- bne.s .B
- bsr addstring print filename
-
- tst.l fib_DirEntryType(a5)
- bpl.s .C
- .F move.l fib_NumBlocks(a5),d0
- add.l d0,temp4(a5)
- move.l fib_Size(a5),d0
- add.l d0,temp1(a5) increase total size
- move.b #" ",(a2)+
- moveq #34,d1
- sub.w d2,d1
- bsr qdecpr
- bra.s prlink
- .C moveq #29,d1
- sub.w d2,d1
- bpl.s .D
- moveq #0,d1
- .D move.b #" ",(a2)+
- dbra d1,.D
- lea dirtext(pc),a1
- bsr addstring
- prlink move.b #" ",(a2)+
- move.b #" ",(a2)+
- move.l fib_DirEntryType(a5),d0
- moveq #-6,d1
- cmp.l d1,d0
- bne.s .B
- move.b #"S",-1(a2)
- bra.s .A
- .B moveq #4,d1
- cmp.l d1,d0
- bne.s .C
- move.b #"H",-1(a2)
- bra.s .A
- .C moveq #-4,d1
- cmp.l d1,d0
- bne.s .A
- move.b #"H",-1(a2)
- .A move.b #" ",(a2)+
- addq.l #1,temp2(a5)
- move.l temp2(a5),d0 are we printing wide
- bpl.s wpro
- btst.l #0,d0
- beq.s .F
- move.b #LF,(a2)+
- .F clr.b (a2)
- lea temp2buf(a5),a1
- bra pr_string print string&return and return
-
- wpro btst #29,temp2(a5)
- beq.s .E
- move.l a2,a0
- bsr pr_pro2 print protection V2.0
- move.b #" ",(a0)+
- move.l a0,a2 (goes to temp2buf)
- btst #24,temp2(a5) protect flag ?
- bne.s .E
- lea fib_Date(a5),a1
- lea -14(sp),sp
- lea (sp),a0
- bsr convert_time
- move.l a2,a1
- bsr qprint10
- move.b #".",(a1)+
- bsr qprint10
- move.b #".",(a1)+
- bsr qprint10
- move.b #" ",(a1)+
- move.b #" ",(a1)+
- bsr qprint10
- move.b #":",(a1)+
- bsr qprint10
- move.b #":",(a1)+
- bsr qprint10
- move.b #LF,(a1)+
- lea 14(sp),sp
- move.l a1,a2
- .E clr.b (a2)
- lea temp2buf(a5),a1
- bsr pr_string print date/time V2.0
-
- move.l d7,d1
- bsr CurrentDir d0=old current dir
- movem.l d0/d4-d7/a3-a4,-(sp)
- move.l d7,d6
- btst.l #28,temp2(a5)
- beq fort
- tst.b fib_Comment(a5)
- beq.s .A
- bsr num_spc
- lea farb2(pc),a1
- bsr addstring
- move.b #":",(a2)+
- clr.b (a2)
- lea temp2buf(a5),a1
- bsr pr_string
- lea fib_Comment(a5),a1
- bsr pr_string print Comment V2.0
- lea farb1(pc),a1
- bsr pr_stringlf
-
- .A cmp.w #36,kickver(a5)
- blo fort
- move.l fib_DirEntryType(a5),d0
- bpl.s .F
- neg.l d0
- .F moveq #4,d1
- cmp.l d0,d1
- bne.s .G
- lea NewPrintBuffer(a5),a2 process hardlinks
- lea farb2(pc),a1
- bsr addstring
- lea pfeil(pc),a1
- bsr addstring
- lea fib_FileName(a5),a0
- move.l a0,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq.s .C
- move.l a2,a0
- bsr eval_full_path
- jsr _LVOUnLock(a6)
- bra.s .B
- .G moveq #-6,d0
- cmp.l fib_DirEntryType(a5),d0 check whether is softlink
- bne.s fort
- lea fib_FileName(a5),a2 process softlinks
- move.l a2,d1
- jsr _LVODeviceProc(a6)
- move.l d0,d4
- beq.s .C
- move.l a2,d3 path (filename)
- lea NewPrintBuffer(a5),a2
- lea farb2(pc),a1
- bsr addstring
- lea pfeil(pc),a1
- bsr addstring
- move.l d4,d1 msgport of device
- move.l d6,d2 lock on current dir
- move.l a2,d4 buffer
- moveq #120,d5 size of buffer
- jsr _LVOReadLink(a6)
- .C bsr maybeDOSerr
- beq.s fort
- .B lea NewPrintBuffer(a5),a1
- bsr pr_string ;print softlink V2.3
- lea farb1(pc),a1
- bsr pr_stringlf
-
- fort move.w temp2(a5),d0 get upper two bytes
- and.w #%0000010010010000,d0 copy,delete or join flag
- beq .B no: try protect
- btst #25,temp2(a5)
- bne .A not process flag ?
-
- btst #22,temp2+1(a5) move flag ?
- beq.s .E
- btst #21,temp2+1(a5) MOVE !
- beq.s .E need not try to rename
- tst.l fib_DirEntryType(a5)
- bpl.s .D delete dir
- lea fib_FileName(a5),a0
- bsr MoveFile
- bne .A
- bclr #21,temp2+1(a5) cannot rename
-
- .E btst #23,temp2+1(a5) copy flag ?
- beq.s .D
- tst.l fib_DirEntryType(a5)
- bpl .H
- lea fib_FileName(a5),a0 COPY !
- bsr CopyFileToDir
- bne .A error occured->not delete
-
- .D btst #26,temp2(a5) delete flag ?
- beq.s .C
- lea fib_FileName(a5),a0 DELETE !
- tst.l fib_DirEntryType(a5)
- bpl.s .I
- bsr DoDelete
- bra.s .C
- .I bsr DoDelete2
-
- .C btst #20,temp2+1(a5) join flag ?
- beq.s .B
- tst.l fib_DirEntryType(a5)
- bpl.s .H
- lea fib_FileName(a5),a0 JOIN !
- bsr JoinFile
-
- .B btst #24,temp2(a5) protect flag ?
- beq.s .A
- move.l fib_Protection(a5),d2 PROTECT !
- eor.b #$0f,d2
- or.l temp5(a5),d2
- and.l temp6(a5),d2
- lea fib_FileName(a5),a0
- move.l a0,d1
- eor.b #$0f,d2
- move.l d2,fib_Protection(a5)
- jsr _LVOSetProtection(a6)
- bsr maybeDOSerr
- lea temp2buf(a5),a2 print new protection
- lea pfeil(pc),a1
- bsr addstring
- move.l a2,a0
- bsr pr_pro2
- move.b #LF,(a0)+
- clr.b (a0)
- bsr pr_string (temp2buf in a1)
-
- bra.s .A
- .H bsr pr_lf
- .A movem.l (sp)+,d0/d4-d7/a3-a4
- move.l d0,d1
- bsr CurrentDir
- rts
-
- qprint10 move.w (a0)+,d0 V2.0
- qpr10 ext.l d0 (also used by more)
- divu #10,d0 Value in d0 , Buffer in a1
- add.b #"0",d0
- move.b d0,(a1)+
- swap d0
- add.b #"0",d0
- move.b d0,(a1)+
- rts
-
- num_spc lea temp2buf(a5),a2 V2.0
- move.w indent_count(a5),d0
- moveq #$3f,d1
- and.l d1,d0
- bra.s .B
- .A move.b #" ",(a2)+ the preceding spaces
- .B dbra d0,.A
- rts
-
- addstring move.b (a1)+,(a2)+
- bne.s addstring
- subq.l #1,a2
- rts
-
- qdecpr * Number in d0.l , Length in d1.w , adds string to buffer in a2
- movem.l d2/d3/a0,-(sp) ;Prints Decimal Number in (a2)
- lea -12(sp),sp
- move.l sp,a0
- move.l d1,d3
- moveq #0,d2
- .A moveq #LF,d1
- bsr div_32
- add.b #$30,d1
- move.b d1,(a0)+
- addq.w #1,d2
- tst.l d0
- bne.s .A
- sub.w d2,d3
- subq.w #1,d3
- bmi.s .B
- .D move.b #" ",(a2)+
- dbra d3,.D
- .B subq.w #1,d2
- .C move.b -(a0),(a2)+
- dbra d2,.C
- lea 12(sp),sp
- movem.l (sp)+,d2/d3/a0
- rts
-
- fixsoftlink
- moveq #3,d0
- cmp.l fib_DirEntryType(a5),d0 is it a softlink ?
- bne.s .A
- move.l #-6,fib_DirEntryType(a5) make it look like a file
- .A rts
-
- *** CHECK CTRL_C
- ** RETURN NE if ctrl c, EQ if not
- check_c movem.l d0-d1/a0-a1/a6,-(sp) checks if CTRL-C pressed
- tst.b break_flag(a5)
- bne.s .A
- moveq #0,d0
- moveq #0,d1
- move.l 4.w,a6
- bset #SIGBREAKB_CTRL_C,d1
- jsr _LVOSetSignal(a6)
- btst #SIGBREAKB_CTRL_C,d0
- beq.s .B
- .A move.l dosbase(a5),a6
- lea breaktx(pc),a1
- bsr pr_string
- moveq #1,d0 NE: STOP!!!
- move.b d0,break_flag(a5)
- movem.l (sp)+,d0-d1/a0-a1/a6
- rts
- .B clr.b break_flag(a5)
- moveq #0,d0 EQ: no stop
- movem.l (sp)+,d0-d1/a0-a1/a6
- rts
-
-
- *ALLOCATE MEMORY D0=size D1=type
- iwantmem movem.l d1/a0-a1,-(sp)
- move.l 4.w,a6
- jsr _LVOAllocMem(a6)
- move.l dosbase(a5),a6
- movem.l (sp)+,d1/a0-a1
- tst.l d0
- rts
- *FREEMEM A1=ptr to mem block D0=size
- givemem move.l 4.w,a6
- jsr _LVOFreeMem(a6)
- move.l dosbase(a5),a6
- rts
-
-
- *REMOVE PATH A0-> source A1->destination
- rempath movem.l d0/a0-a2,-(sp)
- rempath1 move.l a0,a2
- rempath2 move.b (a0)+,d0
- cmp.b #'/',d0
- beq.s rempath1
- cmp.b #':',d0
- beq.s rempath1
- tst.b d0
- bne.s rempath2
- move.l a2,a0
- bsr cp_string
- movem.l (sp)+,d0/a0-a2
- rts
-
-
- ** PRINT STRING (A1) USING indent_count(a5) AS A SPACE INDENT COUNT
- prindent movem.l d7/a0-a1,-(sp)
- move.w indent_count(a5),d7
- move.l a1,a0
- and.w #$3f,d7
- beq.s .A
- bra.s .B
- .C bsr pr_space print d7 spaces
- .B dbra d7,.C
- move.l a0,a1
- .A bsr pr_string
- movem.l (sp)+,d7/a0-a1
- rts
-
- ** ENTRY A0 pts to parameter.
- ** EXIT D0=lower case char after dash OR 0 if no dash command.
- return_dash_option
- moveq #0,d0
- cmp.b #'-',(a0)
- bne.s .B
- .A move.b 1(a0),d0
- cmp.b #'a',d0
- blo.s .B
- cmp.b #'z',d0
- bhi.s .B
- sub.b #$20,d0
- .B rts
-
- check_q_r ;checks for -q, -s or -r (or ALL) options, parm-ptr in a2
- lea parm2(a5),a2
- clr.b recurs_flag(a5)
- btst #FLall,Flags+3(a5)
- beq.s .A
- lea alltx(pc),a0
- bsr LookForOpt
- bne.s .A
- move.b #1,recurs_flag(a5)
- .A move.l a2,a1
- move.l (a1),d0
- beq.s .E
- move.l d0,a0
- bsr return_dash_option
- tst.l d0
- beq.s .E
- cmp.b #"R",d0
- bne.s .B
- move.b #1,recurs_flag(a5) -r -> recursive
- bra.s .G
- .B cmp.b #"Q",d0
- bne.s .C
- bset #30,temp2(a5) -q -> quick,nosort
- bra.s .G
- .C cmp.b #"S",d0
- bne.s .E
- bclr #30,temp2(a5) -s -> noquick,sort
- .G lea 4(a1),a0
- .F move.l (a0)+,(a1)+
- bne.s .F
- bra.s .A
- .E rts
-
-
- CurrentDir ;same as _LVOCurrentDir(a6)
- move.l thistask(a5),a0
- lea pr_CurrentDir(a0),a0
- move.l (a0),d0
- move.l d1,(a0)
- rts
-
- *************************
- * DELETE * V2.3 new written
- *************************
- deletez clr.l temp2(a5)
- bset #26,temp2(a5)
- bsr check_q_r
- move.l (a2),d0
- beq too_less_args
- move.l d0,a0
- lea devicetx(pc),a1
- bsr CheckOpt
- beq deldevice format device quick
- lea forcetx(pc),a0
- bsr LookForOpt FORCE-flag ?
- subq.l #1,d0
- move.l d0,temp5(a5)
- bra directory2 delete as many files as given
-
- DoDelete ;file to delete in a0
- btst.l #30,temp2(a5)
- bne.s DoDelete2
- btst.l #22,temp2+1(a5) move-> do not ask
- bne.s DoDelete2
- move.l a0,-(sp) ASK first
- move.l stdin(a5),d1
- beq.s DoDelete2
- lea yesnotx(pc),a1
- bsr pr_string
- bsr raw_on
- lea temp2buf(a5),a2
- clr.b (a2)
- move.l a2,d2
- moveq #20,d3 read only 1 char
- jsr _LVORead(a6)
- clr.b 1(a2)
- move.l a2,a1
- bsr pr_string show it
- bsr pr_space
- bsr rawh_off
- move.l (sp)+,a0
- or.b #$20,(a2)
- cmp.b #"y",(a2) yes ?
- beq.s DoDelete2
- cmp.b #"a",(a2) all ?
- bne.s .A
- bset #30,temp2(a5) set quick flag
- bra.s DoDelete2
- .A cmp.b #"q",(a2) quit ?
- bne.s .E
- move.b #1,break_flag(a5)
- .E bsr pr_lf
- bra.s DoDeEnd
- DoDelete2
- move.l a0,a2
- .E move.l a2,d1
- jsr _LVODeleteFile(a6) delete file/dir
- tst.l d0
- bne.s .B
- .D jsr _LVOIoErr(a6)
- cmp.l #222,d0 delete-protected ?
- bne.s .A
- tst.l temp5(a5) FORCE-flag ?
- beq.s .A
- move.l a2,d1
- moveq #0,d2
- jsr _LVOSetProtection(a6)
- tst.l d0
- beq.s .D
- bra.s .E try again
- .A btst.l #22,temp2+1(a5)
- bne.s .F move: do not print lf
- bsr pr_lf error occured
- .F bsr pr_DOSerr
- bra.s DoDeEnd
- .B lea deleteOK(pc),a1 delete successful
- btst.l #22,temp2+1(a5)
- bne.s DoDeEnd move: do not print
- bsr pr_string
- DoDeEnd rts
-
- *************************
- deldevice ;formats device quick V2.3
- bsr CheckKS
- move.l parm3(a5),d1
- beq too_less_args
- move.l d1,a2
- moveq #-2,d2
- jsr _LVOLock(a6) lock on drive
- move.l d0,d7
- beq DOSerr
- move.l d0,d1
- move.l a5,d2 get info data into fib
- jsr _LVOInfo(a6)
- tst.l d0
- beq DOSerrUL
- move.l d7,d1
- jsr _LVOUnLock(a6)
- lea formatask(pc),a1
- bsr pr_string
- bsr rask
- tst.l d0
- beq.s .A
- move.l parm4(a5),d4
- bne.s .B
- move.l id_VolumeNode(a5),a0
- add.l a0,a0
- add.l a0,a0
- move.l $28(a0),d4 volumename
- lsl.l #2,d4
- addq.l #1,d4
- .B move.l parm5(a5),d0 check for filesystem
- beq.s .D
- lea ofs_tx(pc),a1
- move.l d0,a0
- moveq #0,d3
- .E bsr CheckOpt
- bne.s .F
- add.l #"DOS"<<8,d3
- bra.s .G
- .F addq.b #1,d3
- cmp.b #6,d3
- bne.s .E
- .D move.l id_DiskType(a5),d3 dostype
- .G move.l a2,d1
- moveq #-1,d2
- jsr _LVOInhibit(a6) disable drive
- tst.l d0
- beq DOSerr
- move.l a2,d1
- move.l d4,d2
- jsr _LVOFormat(a6) format it quick !
- bsr maybeDOSerr
- move.l a2,d1
- moveq #0,d2
- jsr _LVOInhibit(a6) enable drive
- tst.l d0
- beq DOSerr
- .A moveq #RETURN_OK,d0
- rts
-
- *************************
- * PROTECT * V2.3 new written
- *************************
- protectz
- clr.l temp2(a5)
- bset #29,temp2(a5) bit 29=verbose flag
- bset #24,temp2(a5) bit 24=protect flag
- bset #30,temp2(a5) bit 30=quick flag
- bsr check_q_r
- tst.l (a2)+
- beq too_less_args
- clr.l temp5(a5)
- clr.l temp6(a5)
- .A move.l (a2)+,d0
- beq.s .D
- move.l d0,a0
- cmp.b #"+",(a0) look for add-option
- bne.s .B
- bsr GetProtMask
- move.l d0,temp5(a5)
- bra.s .C
- .B cmp.b #"-",(a0) look for sub-option
- bne.s .A
- bsr GetProtMask
- move.l d0,temp6(a5)
- .C move.l a2,a0
- lea -4(a2),a1
- .E move.l (a0)+,(a1)+ delete this parm
- bne.s .E
- subq.l #4,a2
- bra.s .A
-
- .D moveq #-1,d0
- eor.l d0,temp6(a5)
- bra directory2 jump into dir-lister
-
-
- GetProtMask ;a0=bits-string, d0=bit-mask
- moveq #0,d0
- addq.l #1,a0
- .B move.b (a0)+,d1
- beq.s .C
- moveq #7,d2
- .A cmp.b protflags(pc,d2.w),d1
- bne.s .D
- bset d2,d0
- bra.s .B
- .D dbra d2,.A
- lea badprotbit(pc),a1
- bsr pr_stringlf
- bra galactic
- .C rts
-
- pr_prot lea temp2buf(a5),a0 V2.0
- pr_pro2 moveq #7,d0
- move.l fib_Protection(a5),d1
- eor.b #$0f,d1
- .A move.b #"-",(a0)+
- btst d0,d1
- beq.s .B
- move.b protflags(pc,d0.w),-1(a0)
- .B dbra d0,.A
- clr.b (a0)
- lea temp2buf(a5),a1
- rts
-
- protflags dc.b 'dewrapsh'
-
- *************************
- * JOIN * V2.3 new written
- *************************
- joinz clr.l temp2(a5)
- bset #20,temp2+1(a5) set join flag
- bsr check_q_r
- clr.l devproc(a5)
- clr.l temp5(a5) destination file
- clr.l temp6(a5) memory block
- lea parm2(a5),a3
- addq.l #4,a3
- tst.l (a3)+
- beq too_less_args no arg given
- .A tst.l (a3)+
- bne.s .A
- move.l -8(a3),a2 get last parm
- clr.l -8(a3) and remove it
- move.l a2,d1
- move.l #MODE_READWRITE,d2
- jsr _LVOOpen(a6)
- move.l d0,temp5(a5) open output file and store it
- beq DOSerr
- move.l d0,d1
- moveq #0,d2
- moveq #1,d3
- jsr _LVOSeek(a6) look for end, no error checking
- bsr GetCopyBlock
- beq .F
- move.l d0,temp6(a5)
- bsr directory2 DO COPY !
- bsr FreeCopyBlock
- .F move.l temp5(a5),d1
- jsr _LVOClose(a6)
- moveq #RETURN_OK,d0
- rts
-
- JoinFile ;a0=filename, temp5=outfile, temp6=mem block
- moveq #0,d4
- move.l a0,d1
- move.l #MODE_OLDFILE,d2
- jsr _LVOOpen(a6) open input file
- move.l d0,d4 d4=input file handle
- beq perr3
- move.l temp5(a5),d5 d5=output file handle
- bsr PerformCopy Main Stuff !
- bne.s .C
- lea joinOK(pc),a1 all OK
- bsr pr_string
- moveq #RETURN_OK,d0
- .C rts
-
- *************************
- * MOVE * V2.3
- *************************
- movez clr.l temp2(a5)
- bset #22,temp2+1(a5) set move flag
- bset #21,temp2+1(a5) set rename flag
- bset #26,temp2(a5) set delete flag
- clr.l temp7(a5) holds full dest. pathname
- bra.s Copy1
-
- MoveFile ;Filename in a0
- move.l a0,a3
- move.l temp7(a5),a0 path
- move.l a3,a1 name
- lea temp2buf(a5),a2 path+name
- bsr addpath
- move.l a2,d2
- move.l a3,d1
- jsr _LVORename(a6)
- tst.l d0
- beq.s .A
- lea moveOK(pc),a1
- bsr pr_string
- moveq #1,d0
- .A rts
-
- *************************
- * COPY * V2.3 new written
- *************************
- copysize = 50000
- copyz clr.l temp2(a5)
- Copy1 bset #23,temp2+1(a5) set copy flag
- bset #30,temp2(a5) bit 30=quick flag
- bsr check_q_r
- clr.l devproc(a5)
- clr.l temp5(a5) destination dir
- clr.l temp6(a5) memory block
- lea parm2(a5),a2
- tst.l (a2)+
- beq too_less_args *no arg given
- tst.l (a2)+
- bne.s Copy2
- lea null(pc),a2 *one arg -> copy to current dir
- bra Copy3b
-
- Copy2 tst.l (a2)+
- bne Copy3
- move.l -8(a2),a0 *two args -> copy to file/dir
- clr.l -8(a2) get it and remove it
- move.l a0,a2
- move.l parm2(a5),a0
- bsr check_wild
- tst.l d0
- beq Copy3b wildcards->copy to dir
- move.l parm2(a5),d1
- btst.l #22,temp2+1(a5)
- beq.s .B move: try to rename
- move.l a2,d2
- jsr _LVORename(a6)
- tst.l d0
- beq.s .B move: failed
- move.l parm2(a5),a1 OK
- bsr pr_string
- bsr pr_space
- lea moveOK(pc),a1
- bsr pr_string
- moveq #RETURN_OK,d0
- rts
- .B move.l parm2(a5),d1
- move.l #MODE_OLDFILE,d2 try to copy file to file:
- jsr _LVOOpen(a6) try to open input file (d4)
- move.l d0,d4
- beq.s Copy3b input not found->maybe a dir
- move.l a2,d1
- move.l #MODE_NEWFILE,d2
- jsr _LVOOpen(a6) try to open output file (d5)
- move.l d0,d5
- bne.s .D
- bsr closett
- bra.s Copy3b
- .D move.l parm2(a5),a1
- bsr pr_string
- bsr pr_space
- bsr GetCopyBlock
- bne.s .A
- bsr closett
- bra resi_no_mem
- .A move.l thistask(a5),a0
- move.l pr_CurrentDir(a0),a3
- move.l a3,temp5(a5)
- bsr PerformCopy do copy !
- move.l d0,d4
- bsr FreeCopyBlock
- tst.l d4 error occured ?
- bne.s .E
- btst #22,temp2+1(a5) move flag ?
- beq.s .C
- move.l parm2(a5),a0
- bsr DoDelete move: delete old file
- .C lea copyOK(pc),a1 all OK
- bsr pr_string
- .E move.l d4,d0
- rts
-
- Copy3 tst.l (a2)+ *three or more args -> copy them to dir
- bne.s Copy3 look for last parm
- move.l -8(a2),a0 get it
- clr.l -8(a2) and remove it
- move.l a0,a2
- Copy3b move.l a2,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6) try to lock dir
- move.l d0,d7
- bne.s .B found
- jsr _LVOIoErr(a6)
- cmp.l #205,d0 object not found ?
- beq.s .C
- bra pr_galactic no
- .C move.l a2,d1
- jsr _LVOCreateDir(a6) yes, make dir
- move.l d0,d1
- beq DOSerr
- jsr _LVOUnLock(a6) unlock and try again
- move.l a2,a1
- bsr pr_string
- bsr pr_space
- lea makedirOK(pc),a1
- bsr pr_string
- bra.s Copy3b
- .B bsr fibexam2
- tst.l fib_DirEntryType(a5) file or dir ?
- bpl.s .E
- move.l d7,d1
- jsr _LVOUnLock(a6) was not a dir
- move.l #212,d0
- bra pr_galactic
- .E move.l d7,temp5(a5) was a dir: store lock
- lea -80(sp),sp
- move.l sp,temp7(a5)
- bsr AdjustPath move: get full path
- move.l a2,d1
- jsr _LVODeviceProc(a6)
- move.l d0,devproc(a5)
- bsr GetCopyBlock
- beq .F
- bsr directory2 DO COPY !
- bsr FreeCopyBlock
- .F lea 80(sp),sp space needed for move
- move.l temp5(a5),d1
- jsr _LVOUnLock(a6) unlock dir
- moveq #RETURN_OK,d0
- rts
-
- GetCopyBlock
- move.l #copysize,d0
- moveq #1,d1
- bsr iwantmem get memory block
- move.l d0,temp6(a5)
- rts
-
- FreeCopyBlock
- move.l temp6(a5),a1
- move.l #copysize,d0
- bra givemem free memory block
-
- CopyFileToDir ;a0=filename
- *current path set, destination path in temp5, memory block in temp6
- moveq #0,d4
- moveq #0,d5
- move.l a0,a2
- move.l a0,d1
- move.l #MODE_OLDFILE,d2
- jsr _LVOOpen(a6) open input file
- move.l d0,d4 d4=input file handle
- move.l temp5(a5),d1
- bsr CurrentDir
- move.l d0,a3 a3 holds current dir
- tst.l d4
- beq perr3 read protected ?
- move.l a2,a0
- lea temp2buf(a5),a2
- move.l a2,a1
- bsr rempath
- move.l a2,d1
- move.l #MODE_NEWFILE,d2
- jsr _LVOOpen(a6) open output file
- move.l d0,d5 d5=output file handle
- move.l a3,d1
- bsr CurrentDir
- tst.l d5
- beq perr3 already exits/disk full ?
- bsr PerformCopy Main Stuff !
- bne.s .C
- cmp.l fib_Size(a5),d6
- beq.s .B
- lea wrongsize(pc),a1 wrong size
- bsr pr_string
- move.l d6,d0
- bsr print10
- bsr pr_lf
- bra.s .A
- .B lea copyOK(pc),a1 all OK
- bsr pr_string
- .A moveq #RETURN_OK,d0
- .C rts
-
- PerformCopy ;dest. filename in a2, d4,d5:filehandles
- clr.l d6 d6 holds filesize
- .A move.l d4,d1
- move.l temp6(a5),d2
- move.l #copysize,d3
- jsr _LVORead(a6) read a block
- move.l d0,d3
- bmi perr2 read error ?
- beq.s recoend
- move.l d5,d1
- move.l temp6(a5),d2
- jsr _LVOWrite(a6) write as much as read
- tst.l d0
- bmi perr2 disk full ?
- cmp.l d0,d3
- bne perr2 disk full ?
- add.l d0,d6 sum up size in d6
- cmp.l #copysize,d3
- bne.s recoend buffer not filled by Read
- lea dot(pc),a1
- bsr pr_string print dots as progress-indicator
- bsr check_c check for CTRL-C break
- beq.s .A
- recoend bsr closett
- adjust tst.l devproc(a5)
- beq.s .A
- move.l temp5(a5),d1
- bsr CurrentDir
- move.l d0,a3
- move.l a2,d1
- move.l fib_Protection(a5),d2
- beq.s .D
- jsr _LVOSetProtection(a6) set old protection
- tst.l d0
- beq perr1
- .D move.l a2,d1
- lea fib_Comment(a5),a0 copy comment
- tst.b (a0)
- beq.s .C
- move.l a0,d2
- jsr _LVOSetComment(a6)
- tst.l d0
- beq perr1
- .C bsr clearArgs set old date
- lea fib_Date(a5),a0
- move.l a0,myArg4(a5)
- move.l devproc(a5),packettask(a5)
- move.l temp5(a5),myArg2(a5)
- lea NewPrintBuffer(a5),a1
- move.l a1,d2
- lsr.l #2,d2
- move.l d2,myArg3(a5)
- addq.l #1,a1
- moveq #-1,d0
- .B addq.l #1,d0
- move.b (a2)+,(a1)+
- bne.s .B
- move.b d0,NewPrintBuffer(a5)
- moveq #ACTION_SET_DATE,d0
- move.l d0,packettype(A5)
- bsr sendpacket
- tst.l sp_res1(a5)
- beq perr1
- move.l a3,d1
- bsr CurrentDir
- .A moveq #RETURN_OK,d0
- rts
-
- perr2
- perr3 bsr closett
- perr1 jsr _LVOIoErr(a6)
- cmp.l #221,d0
- bne.s .A
- move.b #1,break_flag(a5) break if disk is full
- .A bsr pr_lf
- bsr pr_DOSerr
- move.l a3,d1
- bsr CurrentDir
- moveq #RETURN_ERROR,d0
- rts
-
- closett move.l d4,d1 ;close files in d4 & d5
- beq.s .A
- jsr _LVOClose(a6)
- moveq #0,d4
- .A btst #20,temp2+1(a5) join: do not close outfile
- bne.s .C
- move.l d5,d1
- beq.s .B
- jsr _LVOClose(a6)
- .C moveq #0,d5
- .B rts
-
-
-
- *************************************************************
- ** ENTRY A0=name
- ** EXIT D0=address, D1=size
- readfile movem.l d2-d6/a0-a4,-(sp)
- move.l a0,d1
- move.l a0,a4
- move.l #MODE_OLDFILE,d2
- jsr _LVOOpen(a6) try to open it in current dir
- move.l d0,d4 d4=handle
- bne.s .A
- moveq #-1,d1 Don't request
- bsr changeWindowPtr
- lea paths(pc),a0
- move.l a4,a1
- lea tempbuf(a5),a2
- bsr addpath
- move.l a2,d1
- move.l #MODE_OLDFILE,d2
- jsr _LVOOpen(a6) try to open it in S: dir
- move.l d0,d4
- beq readerr
- moveq #0,d1 request on
- bsr changeWindowPtr
-
- .A moveq #1,d3 open succeded
- moveq #0,d2
- move.l d4,d1
- jsr _LVOSeek(a6)
- moveq #-1,d3
- moveq #0,d2
- move.l d4,d1
- jsr _LVOSeek(a6)
- move.l d0,d5 d5=size, handles also powerpacked files
- moveq #1,d1
- bsr iwantmem
- beq readerr2
- move.l d0,d6 d6=addr
- move.l d6,d2
- move.l d5,d3
- move.l d4,d1
- jsr _LVORead(a6) READ IT
- tst.l d0
- bmi readerr3
- move.l d4,d1
- jsr _LVOClose(a6) close it
- move.l d6,d0
- move.l d5,d1
- movem.l (sp)+,d2-d6/a0-a4
- rts
- readerr3 move.l d6,a1
- move.l d5,d0
- bsr givemem ;NB won't work correctly if memory fail occurs.
- ;Will try to print DOS error for this
- readerr2 move.l d4,d1
- jsr _LVOClose(a6)
- readerr moveq #0,d1
- bsr changeWindowPtr
- bra DOSerr
-
- *****************
- * MORE *
- *****************
- morez tst.l parm2(a5)
- beq too_less_args
- moveq #0,d4
- move.l parm3(a5),d0
- beq .C
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- tst.w d0
- beq.s .C
- subq.w #1,d0
- move.w d0,d4
-
- .C move.l parm2(a5),a0
- bsr readfile
- moveq #0,d2
- ViewMore ;Jump-In to review the buffer
- move.l d0,-(sp) push address
- move.l d1,-(sp) push size
- bsr make_screen
- move.l (sp)+,d0
- move.l (sp)+,a1
- bsr givemem
- moveq #RETURN_OK,D0
- RTS
-
- make_screen * more main-routine, also used for help
- * Entry: d0=start adress, d1=length, d4=number of lines or 0, d2=lookback
- movem.l d0-d2,-(sp)
- addq.b #1,noreview_flag(a5)
- clr.l temp1(a5)
- tst.l ConsoleSwitch(a5)
- bne.s .F
- addq.l #1,temp1(a5)
- move.l thistask(a5),a3
- move.l pr_ConsoleTask(a3),ConsoleSwitch(a5)
- bsr raw_on
- .F btst #FLcutline,Flags+3(a5)
- beq.s .G
- lea cutontx(pc),a1
- bsr pr_string
- .G tst.w d4
- bne.s .A
- bsr GetWinSize
- move.w d0,d4
- .A movem.l (sp)+,d0-d2
- move.w d4,line_count(a5)
- move.l d0,d5 d5=start
- move.l d0,a4 a4=ptr
- move.l d0,a3
- move.l d0,d6
- add.l d1,d6 d6=end addr
- tst.l d2
- beq.s mk_screen
- move.l d6,a4
- bra look_back
- mk_screen
- lea clrhide(pc),a1
- bsr pr_string
- move.w line_count(a5),d2
- move.l a4,-(sp)
- moveq #0,d0
- bra.s .A
- .C moveq #1,d0 PRINT SCREEN FULL OF LINES
- .A; bsr pr_line
- .B cmp.l d6,a4 check against end
- beq.s .E
- move.b (a4)+,d0
- cmp.b #LF,d0
- bne.s .B
- dbra d2,.C
- move.l a4,a3 A3 points to end of page marker
- .E move.l a4,d7 D7 points to end
- move.l (sp)+,a4
- ; bra waitabit
-
- move.l a4,d2
- move.l outhandle(a5),d1
- beq.s waitabit
- move.l d7,d3
- sub.l a4,d3
- subq.l #1,d3
- bmi.s waitabit don't print if 0
- cmp.l d7,d6
- bne.s .D
- cmp.l a3,d7
- beq.s .D
- addq.l #1,d3
- .D jsr _LVOWrite(a6)
-
- waitabit
- move.l stdin(a5),d1
- beq cloga
- lea tempbytes(a5),a0
- move.l a0,d2
- moveq #1,d3
- jsr _LVORead(a6) wait for space key
- .A moveq #0,d0 clear top bytes
- move.b tempbytes(a5),d0 test byte of input line
- cmp.b #$9b,d0
- beq.s waitabit CSI ? Try again !
- tastes cmp.b #'a',d0
- ; blo.s go_upper
- ; sub.b #$20,d0
-
- go_upper cmp.b #$42,d0 cursor down ?
- beq.s .G
- cmp.b #"2",d0
- bne.s ck_up
- .G cmp.l d7,d6
- beq waitabit
- lea scroll_up_tx(pc),a1 SCROLL UP ONE LINE,
- bsr pr_string SEND CURSOR TO START OF LINE
- .B cmp.l d6,a4 advance one line
- beq.s .C
- move.b (a4)+,d0
- cmp.b #LF,d0
- bne.s .B
- .C cmp.l d6,a3 move a3 down one line too
- beq.s .D
- move.b (a3)+,d0
- cmp.b #LF,d0
- bne.s .C
- .D move.l a4,-(sp)
- move.l d7,a4
- ; cmp.l d7,d6
- ; beq.s .A
- moveq #0,d0
- bsr pr_line print line from d7
- .A cmp.l d6,a4 advance D7 one line
- beq.s .E
- move.b (a4)+,d0
- cmp.b #LF,d0
- bne.s .A
- .E move.l a4,d7
- move.l (sp)+,a4
- bra waitabit
-
- ck_up cmp.b #$41,d0 V2.0 cursor up ?
- beq.s .G
- cmp.b #"8",d0
- bne.s ck_fwd
- .G cmp.l d5,a4
- beq waitabit
- lea scroll_down_tx(pc),a1 SCROLL DOWN ONE LINE,
- bsr pr_string SEND CURSOR TO TOP LEFT
- cmp.l d5,a4
- bls.s .E
- subq.l #1,a4
- .B cmp.l d5,a4
- beq.s .A
- cmp.b #LF,-(a4)
- bne.s .B
- addq.l #1,a4
- .A moveq #0,d0
- bsr pr_line
- .E move.l d7,a3
- cmp.l d5,a3
- beq.s .C
- subq.l #1,a3
- .D cmp.l d5,a3
- beq.s .C
- cmp.b #LF,-(a3)
- bne.s .D
- addq.l #1,a3
- .C move.l a3,d7
- lea temp2buf(a5),a1
- move.b #$9b,(a1)+
- move.w line_count(a5),d0
- addq.w #1,d0
- bsr qpr10
- move.b #"H",(a1)+
- clr.b (a1)
- lea temp2buf(a5),a1
- bsr pr_string CURSOR some lines down
- bra waitabit
-
- ck_fwd cmp.b #$43,d0 cursor right ?
- beq.s .A
- cmp.b #"3",d0
- beq.s .A
- cmp.b #" ",d0
- bne.s ck_top
- .A cmp.l d7,d6 one page forward
- beq waitabit
- move.l a3,a4
- bra mk_screen
- ck_top cmp.b #$54,d0 shift cursor up ?
- beq.s .A
- cmp.b #"7",d0
- bne.s ck_bot
- .A cmp.l d5,a4 start of text
- beq waitabit
- move.l d5,a4
- bra mk_screen
- ck_bot cmp.b #$53,d0 shift cursor down ?
- beq.s .A
- cmp.b #"1",d0
- bne.s ck_back
- .A cmp.l a3,d6 end of text
- beq waitabit
- move.l d6,a4
- bra.s look_back
- ck_back cmp.b #$44,d0 cursor left ?
- beq.s .A
- cmp.b #"9",d0
- beq.s .A
- cmp.b #8,d0
- bne.s ck_skey
- .A cmp.l d5,a4 one page back
- beq waitabit
- look_back
- move.w line_count(a5),d1
- addq.w #1,d1
- mlook2 cmp.l d5,a4 check against start
- beq.s .E
- move.b -(a4),d0
- cmp.b #LF,d0
- bne.s mlook2
- dbra d1,mlook2
- lea 1(a4),a4
- .E bra mk_screen
-
- ck_skey cmp.b #"s",d0 V2.0 search string ?
- bne.s ck_jkey
- bsr raw_off
- lea msearch(pc),a1
- bsr pr_string
- lea tempbuf(a5),a2
- move.b (a2),d4 save first char
- move.l a2,d2
- moveq #120,d3
- move.l stdin(a5),d1
- beq.s .A
- jsr _LVORead(a6)
- tst.l d0
- bmi.s .A
- move.l a2,a1
- add.l d0,a2
- subq.l #1,a2
- move.b d4,(a2)
- cmp.l a1,a2 just pressed return ?
- beq.s .B
- clr.b (a2) no
- .B move.l d5,a3
- move.l a4,a0
- bsr find_end_of_line
- move.l a0,a2
- move.l d6,a0
- bsr searchSTR
- cmp.b #LF,d0
- bne.s .A
- move.l a1,a4 set begin of line on top
- bra.s .C
- .A bsr DisplayBeep
- .C bsr raw_on
- bra mk_screen
-
- ck_jkey cmp.b #"j",d0 V2.3 jump to % ?
- bne.s ck_wkey
- bsr raw_off
- lea mjump(pc),a1
- bsr pr_string
- lea tempbuf(a5),a2
- move.l a2,d2
- moveq #120,d3
- move.l stdin(a5),d1
- beq.s .A
- jsr _LVORead(a6)
- tst.l d0
- bmi.s .A
- move.l a2,a1
- add.l d0,a2
- subq.l #1,a2
- cmp.l a1,a2 just pressed return ?
- beq.s .A
- clr.b (a2) no
- bsr convert_ASCII_to_num
- beq.s .A
- moveq #100,d1
- cmp.l d1,d0
- bhi.s .A
- move.l d6,d1
- sub.l d5,d1 calc % of size
- bsr mult_32x32
- moveq #100,d1
- bsr div_32
- move.l d5,a4
- add.l d0,a4 new pointer
- bsr raw_on
- moveq #0,d1
- bra mlook2 search begin of line
- .A bsr raw_on
- bra mk_screen
-
- ck_wkey cmp.b #"w",d0 V2.3 write text to file (or print) ?
- bne.s ck_hkey
- bsr raw_off
- lea mwrite(pc),a1
- bsr pr_string
- lea tempbuf(a5),a2
- move.l a2,d2
- moveq #120,d3
- move.l stdin(a5),d1
- beq.s .C
- jsr _LVORead(a6)
- move.l a2,a1
- add.l d0,a2
- subq.l #1,a2
- clr.b (a2) null-end
- cmp.l a1,a2 just pressed return ?
- beq.s .C yes,quit
- move.l a1,d1
- move.l #MODE_NEWFILE,d2
- jsr _LVOOpen(a6)
- move.l d0,d4
- beq.s .C
- move.l d4,d1
- move.l d5,d2
- move.l d6,d3
- sub.l d2,d3
- jsr _LVOWrite(a6)
- move.l d4,d1
- jsr _LVOClose(a6)
- .C bsr raw_on
- bra mk_screen
-
- ck_hkey cmp.b #"h",d0 V2.3 help info ?
- beq.s .A
- cmp.b #$3f,d0 help key ?
- bne.s ck_rkey
- .A move.l d6,d2
- sub.l d5,d2
- move.l d2,-(sp)
- move.l a4,d0
- sub.l d5,d0
- moveq #100,d1
- bsr mult_32x32
- move.l d2,d1
- bsr div_32
- move.w d0,-(sp)
- move.l sp,a1
- lea helpmor(pc),a0
- bsr new_print
- addq.l #6,sp
- bra waitabit
-
- ck_rkey cmp.b #"r",d0 V2.3 resized window ?
- bne.s unknown_key
- bsr GetWinSize
- move.w d0,line_count(a5)
- bra mk_screen
-
- unknown_key
- btst #FLcutline,Flags+3(a5) unknown key to exit !
- beq.s .G
- lea cutofftx(pc),a1
- bsr pr_string
- .G lea show_cursor(pc),a1
- bsr pr_stringlf
- tst.l temp1(a5)
- beq.s .F
- bsr raw_off
- clr.l ConsoleSwitch(a5)
- .F clr.b noreview_flag(a5)
- moveq #RETURN_OK,d0
- rts
-
- find_end_of_line
- .B cmp.l d6,a0 check against end
- bhs.s .A
- move.b (a0)+,d0
- cmp.b #LF,d0
- bne.s .B
- lea -1(a0),a0
- .A rts
-
- ** PRINT STRING AT A4 ENDING IN LF
- pr_line movem.l d0-d4/a0,-(sp)
- move.l d0,d4
- move.l a4,d2
- move.l outhandle(a5),d1
- beq.s .C
- move.l a4,a0
- bsr find_end_of_line
- sub.l a4,a0
- move.l a0,d3
- tst.l d4
- beq.s .A
- subq.l #1,d2
- addq.l #1,d3
- .A tst.l d3
- beq.s .C don't print if 0
- jsr _LVOWrite(a6)
- .C movem.l (sp)+,d0-d4/a0
- rts
-
- GetWinSize
- move.l a2,-(sp)
- lea askforsize(pc),a1
- bsr pr_string
- .B move.l stdin(a5),d1
- beq cloga
- lea tempbuf(a5),a2
- move.l a2,d2
- moveq #100,d3
- jsr _LVORead(a6) get size of window
- add.l d0,a2
- cmp.b #"r",-(a2)
- bne.s .B
- moveq #1,d1
- .C cmp.b #";",-(a2)
- bne.s .C
- dbra d1,.C
- addq.l #1,a2
- move.l a2,a1
- bsr convert_ASCII_to_num
- tst.l d0
- beq.s .D
- bpl.s .E
- .D moveq #10,d0
- .E subq.w #1,d0
- move.l (sp)+,a2
- rts
-
- *****************
- * TYPE * Type out ASCII file command
- *****************
- typez tst.l parm2(a5)
- beq too_less_args
- move.l parm2(a5),a0
- bsr readfile
- bsr rawh_off MAKE SURE YOU CAN PRESS SPACE TO HOLD IT
- move.l d0,-(sp) push address
- move.l d1,-(sp) push size
- move.l d0,a4 a4=ptr
- move.l d0,d6
- add.l d1,d6 d6=end addr
- next_scr bsr pr_screen
- freef1 move.l (sp)+,d0
- move.l (sp)+,a1
- bsr givemem
- moveq #RETURN_OK,D0
- RTS
-
- ** ENTRY D6=end of file A4=current pos
- pr_screen bsr check_c
- bne type_break
- moveq #0,d0
- bsr pr_line
- bsr pr_lf
- .B cmp.l d6,a4 check against end
- bhs.s type_break
- move.b (a4)+,d0
- cmp.b #LF,d0
- bne.s .B
- bra.s pr_screen
- type_break
- moveq #RETURN_OK,D0
- rts
-
- ***********************
- * EXECUTE SCRIPT FILE *
- ***********************
- executez tst.l parm2(a5)
- beq too_less_args
- bsr fixpam2
- xz2 bsr readfile A0 pts to filename
- move.l d0,a0
- cmp.l #$000003f3,(a0) is it executable ?
- beq.s exerr
- addq.l #4,sp kill return address
- xz3 move.l d0,a0
- cmp.w #"/*",(a0)
- beq.s xrexx
- move.l d1,scsize(a5)
- move.l d0,scaddr(a5)
- move.l d0,scptr(a5)
- move.b #1,scflag(a5) make shell think text lines are in memory
- clr.b mult_comm_flag(a5)
- bra chorus
- exerr moveq #RETURN_ERROR,d0
- rts
- xrexx move.l d0,a1 execute AREXX-script
- move.l d1,d0
- bsr givemem kill script
- lea CLIbuf(a5),a0
- move.l parm1(a5),d0
- beq.s .A
- move.l d0,a1
- .B move.b (a1)+,(a0)+ copy rexx-file to CLIbuf
- bne.s .B
- .A lea rexxtx(pc),a1
- move.l a1,parm1(a5)
- bra notfound execute archie3
-
- *****************
- * ECHO *
- *****************
- echoz lea parm2(a5),a3
- move.l (a3)+,d0
- beq.s echo3
- bra.s echo5
- echo2 move.l (a3)+,d0
- bne.s echo4
- echo3 moveq #RETURN_OK,d0
- rts
- echo4 bsr pr_space
- echo5 move.l d0,a0
- move.l a0,a1
- move.l a0,a2
- bra.s .C
- .B move.b d0,(a2)+
- .C move.b (a0)+,d0
- beq.s .A
- cmp.b #$5c,d0 ;\ Ignore Specialchar
- bne.s .D
- move.b (a0)+,d0
- bra.s .B
- .D cmp.b #'^',d0 ^-Character
- bne.s .B
- move.b (a0)+,d0
- cmp.b #"*",d0
- bne.s .G
- move.b #$9b,d0
- bra.s .B
- .G cmp.b #"$",d0 Number given ?
- beq.s .F
- cmp.b #"0",d0
- blo.s .E
- cmp.b #"9",d0
- bhi.s .E
- .F subq.l #1,a0
- movem.l d1/d2/a1,-(sp)
- move.l a0,a1
- bsr convert_ASCII_to_num
- lea -1(a1),a0
- movem.l (sp)+,d1/d2/a1
- cmp.b #".",(a0)
- bne.s .B
- addq.l #1,a0
- bra.s .B Number was given
- .E and.b #$3f,d0 Control Char
- bra.s .B
- .A clr.b (a2)+
- bsr pr_string
- bra echo2
-
- *****************
- * CLS *
- *****************
- clsz lea clstx(pc),a1
- bsr pr_string
- moveq #RETURN_OK,d0
- rts
-
- ** MEM INFO :RETURN 3 LONGWORDS AT A0 -> FREE CHIP,FAST,TOTAL
- memory_info
- movem.l a0-a2/a6,-(sp)
- move.l a0,a2
- move.l 4.w,a6
- jsr _LVOForbid(a6) ; don't let 'em change while we ask
- move.l #MEMF_CHIP,d1 ; ok, check free chip
- jsr _LVOAvailMem(a6) ; ask system how much there is
- move.l d0,(a2)
- move.l #MEMF_FAST,d1 ; check fast mem avail
- jsr _LVOAvailMem(a6)
- move.l d0,4(a2)
- move.l #MEMF_PUBLIC,d1 ; get all available memory
- jsr _LVOAvailMem(a6)
- move.l d0,8(a2)
- jsr _LVOPermit(a6)
- movem.l (sp)+,a0-a2/a6
- rts
-
- *****************
- * AVAIL *
- *****************
- availz tst.l parm2(a5)
- beq.s .A
- move.l parm2(a5),a0
- bsr return_dash_option
- cmp.b #'C',d0
- bne.s .A
- bsr giveman free some memory
- move.l 4.w,a6
- moveq #-1,d0 Free mem
- move.l #$00002711,d1 MAGIC NUMBER (from FIDO-net)
- jsr _LVOAllocMem(a6)
- jsr _LVOForbid(a6)
- movea.l a6,a0
- moveq #72,d0
- add.l d0,a0
- moveq #15,d0 free 16 interrupts
- moveq #-1,d1
- moveq #12,d2
- .B add.l d2,a0
- cmp.l (a0),d1
- bne.s .C
- cmp.l 4(a0),d1
- bne.s .C
- clr.l (a0)
- clr.l 4(a0)
- .C dbra d0,.B
- jsr _LVOPermit(a6)
- move.l dosbase(a5),a6
- .A lea -12(sp),sp show mem
- lea (sp),a0
- bsr memory_info
- move.l a0,a1
- lea memess(pc),a0
- bsr new_print show memory
- lea 12(sp),sp
- moveq #RETURN_OK,d0
- rts
-
-
- * ALTER WINDOW PTR FOR THIS PROCESS. USE TO DISABLE REQUESTERS POPPING UP.
- * ENTRY D1=0 (NORMAL) D1=-1 (SUBNORMAL, no requesters).
- changeWindowPtr
- movem.l d1/a0,-(sp)
- tst.l d1
- bne.s .A
- move.l window_old(a5),d1
- .A move.l thistask(a5),a0
- move.l d1,pr_WindowPtr(a0)
- movem.l (sp)+,d1/a0
- rts
-
- raw_on movem.l d6/d7,-(sp) switch console to raw mode
- btst #FLhide,Flags+2(a5)
- beq.s .A
- lea show_cursor(pc),a1
- bsr pr_string
- .A moveq #-1,d6
- bra.s raw_switch
-
- rawh_off movem.l d6/d7,-(sp) like raw_off,but hides the cursor
- btst #FLhide,Flags+2(a5)
- beq.s .A
- lea hide_cursor(pc),a1
- bsr pr_string
- .A moveq #0,d6
- bra.s raw_switch
-
- raw_off movem.l d6/d7,-(sp) switch console to normal mode
- moveq #0,d6
- ; bra.s raw_switch
-
- *WINDOW TYPE CHANGER
- raw_switch
- move.l ConsoleSwitch(a5),d7
- beq.s .A
- move.l d7,packettask(a5)
- bsr clearArgs
- move.l #ACTION_SCREEN_MODE,packettype(a5)
- move.l d6,myArg1(a5)
- bsr sendpacket
- .A movem.l (sp)+,d6/d7
- rts
-
- clearArgs movem.l d0/a0,-(sp)
- lea sp_node(a5),a0
- moveq #16,d0 ;68bytes
- .A clr.l (a0)+
- dbra d0,.A
- movem.l (sp)+,d0/a0
- rts
-
- ** ENTRY Uses myArg1-myArg7, and packettask, packettype
- sendpacket tst.l packettask(a5)
- beq.s .A
- movem.l d0-d1/a0-a2,-(sp) V2.0 (new written)
- bsr sendpacket2
- move.l a2,a0
- jsr _LVOWaitPort(a6)
- move.l a2,a0
- jsr _LVOGetMsg(a6)
- move.l dosbase(a5),a6
- movem.l (sp)+,d0-d1/a0-a2
- .A rts
-
- sendpacket2 ;used by sendpacket and get_one_char
- move.l 4.w,a6
- move.b #5,LN_TYPE+sp_node(a5) message
- move.l thistask(a5),a2
- lea pr_MsgPort(a2),a2 Process-MsgPort !
- move.l a2,sp_reply(a5) Replyport
- move.l a2,sp_port(a5)
- move.w #dp_SIZEOF+4,sp_length(a5)
- lea sp_link(a5),a0
- ; move.l a0,sp_ptr(a5)
- move.l a0,LN_NAME+sp_node(a5) points to link
- lea sp_node(a5),a1
- move.l a1,sp_link(a5) linked to itself
- move.l packettask(a5),a0
- jsr _LVOPutMsg(a6)
- rts
-
- *************************
- * RELABEL *
- *************************
- relabelz tst.l parm3(a5)
- beq too_less_args
- move.l parm2(a5),a0
- bsr check_for_colon
- bne no_col
- .D move.l parm2(a5),d1 PARM2=DF0: etc
- jsr _LVODeviceProc(a6)
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- move.l #256,d0
- moveq #1,d1
- bsr iwantmem ASSUME GETS 256 BYTES
- move.l d0,a2 A2=destination
- lsr.l #2,d0
- bsr clearArgs
- move.l d0,myArg1(a5) BPTR to my string
- move.l parm3(a5),a0 NewName
- lea 1(a2),a1 A1=after count
- moveq #0,d0
- .A move.b (a0)+,(a1)+
- addq.l #1,d0
- cmp.b #':',(a0) ALLOW FOR IDIOTS WHO PUT : ON END
- beq.s .C
- tst.b (a0)
- bne.s .A
- .C clr.b (a1)
- move.b d0,(a2)
- moveq #ACTION_RENAME_DISK,d0
- move.l d0,packettype(a5) TYPE=RENAME_DISK
- bsr sendpacket
- move.l a2,a1
- move.l #256,d0
- bsr givemem
- bsr changedisk ;(moved to dc)
- * bsr eval_CD -IS MORE ELEGANT IF I LEAVE OUT.
- moveq #RETURN_OK,d0 USER WILL HAVE TO TYPE CD TO CHANGE
- rts PROPER.
-
- *************************
- * ADDBUFFERS *
- *************************
- addbuffersz
- cmp.w #36,kickver(a5)
- blo.s .A
- move.l parm2(a5),d3
- beq too_less_args
- move.l parm3(a5),d0
- beq.s .B
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- .B move.l d3,d1
- move.l d0,d2
- jsr _LVOAddBuffers(a6)
- tst.l d0
- beq DOSerr
- moveq #-1,d1
- cmp.l d1,d0
- bne.s .C
- jsr _LVOIoErr(a6)
- .C move.l d0,-(sp)
- move.l d3,-(sp)
- lea (sp),a1
- lea addbufftx(pc),a0
- bsr new_print
- addq.l #8,sp
- bra.s .D
-
- .A tst.l parm3(a5)
- beq too_less_args
- bsr clearArgs
- move.l parm3(a5),a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- cmp.l #32767,d0
- bhi bad_number_error
- move.l d0,myArg1(a5)
- move.l parm2(a5),d1 PARM2=DF0: etc
- jsr _LVODeviceProc(a6)
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- moveq #ACTION_MORE_CACHE,d0
- move.l d0,packettype(A5)
- bsr sendpacket
- bsr PKTerr
- .D moveq #RETURN_OK,d0
- rts
-
- *************************
- * DIE-Handler *
- *************************
- diez move.l parm2(a5),d1
- beq too_less_args
- move.l d1,a0
- bsr check_for_colon
- bne.s .A
- bsr clearArgs ;kill filesystemhandler
- jsr _LVODeviceProc(a6) PARM2=DF0: etc
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- moveq #ACTION_DIE,d0
- move.l d0,packettype(A5)
- bsr sendpacket
- bsr PKTerr
- .B moveq #RETURN_OK,d0
- rts
-
- .A move.l d1,a2
- bsr findtsk
- beq.s .B
- move.l pr_CIS(a0),d2
- move.l pr_COS(a0),d3
- move.l a0,a1
- move.l 4.w,a6
- jsr _LVORemTask(a6)
- move.l dosbase(a5),a6
- move.l d2,d1
- beq.s .C
- jsr _LVOClose(a6)
- .C move.l d3,d1
- beq.s .D
- jsr _LVOClose(a6)
- .D bra.s .B
-
- *************************
- * SETDATE *
- *************************
- setdatez tst.l parm2(a5)
- beq too_less_args
- move.l parm2(a5),a2
- bsr clearArgs
- lea date_mark(a5),a0
- lea (a0),a3
- move.l a0,myArg4(a5) ;APTR datestamp
- bsr get_time
- tst.l parm3(a5)
- beq nospda
- move.l a2,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- beq DOSerr
- bsr fibexam2
- move.l d7,d1
- jsr _LVOUnLock(a6)
- lea -14(sp),sp
- lea (sp),a0
- lea fib_Date(a5),a1
- bsr convert_time
- lea parm3(a5),a0
- lea (sp),a1
- bsr settime
- move.w 12(sp),d1
- lea 14(sp),sp
- tst.l d0
- beq .B
- rts
-
- .B lea (a3),a0
- move.l d5,(a0)+ ;days
- divu #60,d6
- move.w d6,d0
- ext.l d0
- move.l d0,(a0)+ ;mins
- swap d6
- mulu #50,d6
- add.l d1,d6
- move.l d6,(a0) ;ticks
- nospda move.l a2,d1 ;filename
- jsr _LVODeviceProc(a6)
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- move.l a2,a0
- lea temp2buf(a5),a1
- move.l a1,a3
- bsr split_wild No wildcard ! Only separates filename !
- move.l a2,d1
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- beq DOSerr
- move.l d0,myArg2(a5) ;BPTR lock
- move.l a3,a0
- lea tempbuf(a5),a1
- moveq #-1,d0
- bsr cpBSTR
- move.l d0,myArg3(a5) ;BSTR filename
- moveq #ACTION_SET_DATE,d0
- move.l d0,packettype(A5)
- bsr sendpacket
- move.l d7,d1
- jsr _LVOUnLock(a6)
- bsr PKTerr
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * DISKCHANGE *
- *************************
- diskchangez
- tst.l parm2(a5)
- beq too_less_args
- move.l parm2(a5),d1 PARM2=DF0: etc
- jsr _LVODeviceProc(a6)
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- bsr changedisk
- moveq #RETURN_OK,d0
- rts
-
- ** USES task in packettask
- changedisk
- bsr clearArgs
- moveq #ACTION_INHIBIT,d0
- move.l d0,packettype(a5)
- moveq #-1,d0 ;1?
- move.l d0,myArg1(a5)
- bsr sendpacket
- bsr PKTerr
- clr.l myArg1(a5)
- bsr sendpacket
- bsr PKTerr
- rts
-
- *************************
- * LOCK *
- *************************
- lockz move.l parm3(a5),a0
- moveq #-1,d7
- bsr CheckOnOff
- bne.s .B
- moveq #0,d7
- .B move.l parm2(a5),d1 PARM2=DF0: etc
- beq too_less_args
- jsr _LVODeviceProc(a6)
- tst.l d0
- beq DOSerr
- move.l d0,packettask(a5)
- bsr clearArgs
- move.l #ACTION_WRITE_PROTECT,d0
- move.l d0,packettype(a5)
- move.l d7,myArg1(a5)
- bsr sendpacket
- bsr PKTerr
- moveq #RETURN_OK,d0
- rts
-
- *********************************
- * UNSET VARIABLE *
- *********************************
- unsetz lea parm2(a5),a3
- .A tst.l (a3)
- beq no_more_unsets
- move.l (a3)+,a0
- bsr check_if_set_already_there
- tst.l d0
- beq unset_failure
- move.l d0,a1
- move.l (a1),d2 GRAB NEXT SET POINTER
- move.l set_size(a1),d0
- move.l d1,a0 D1=prior set
- move.l d2,(a0) SKIP OVER SET TO DELETE
- bsr givemem
- bra .A
- no_more_unsets
- moveq #RETURN_OK,d0
- rts
- unset_failure
- lea temp2buf(a5),a1
- bsr pr_string
- lea bad_unset_tx(pc),a1
- bsr pr_string
- moveq #RETURN_ERROR,d0
- rts
-
- *********************************
- * SET VARIABLE KEY *
- *********************************
- set_link equ 0
- set_size equ 4
- set_name equ 8
- set_defn equ 24
-
- set_funcz
- move.l parm2(a5),d0 SEE IF ANY PARAMETERS TYPED
- beq.s show_current_sets
- tst.l parm3(a5)
- beq.s show_current_sets
- move.l d0,a0 A0=parm2
- bsr check_if_set_already_there
- tst.l d0
- beq create_new_set
- movem.l a0-a1,-(sp) * update old set
- move.l d0,a1 first delete old one
- move.l (a1),d2 GRAB NEXT SET POINTER
- move.l set_size(a1),d0
- move.l d1,a0 D1=prior set
- move.l d2,(a0) SKIP OVER SET TO DELETE
- bsr givemem
- movem.l (sp)+,a0-a1 and replace with new set
- bra create_new_set
-
- show_current_sets
- bsr rawh_off
- move.l first_set_defn(a5),d0
- beq no_sets_to_show
- show_next_set
- move.l d0,a3
- lea set_name(a3),a1
- bsr pr_string
- bsr pr_tab
- lea set_defn(a3),a1
- bsr pr_stringlf
- move.l (a3),d0 CHECK NEXT SET ADDRESS
- bne show_next_set
- no_sets_to_show
- moveq #RETURN_OK,d0
- rts
-
- create_new_set ;a0=name a1=def
- lea tempbuf(a5),a3 GET BIG BLOCK
- lea set_name(a3),a1
- bsr cp_string COPY SET NAME TO SPACE
- bsr ConvertSemi
- lea CLIbuf(a5),a0 use CLIbuf, end in a1
- .D move.b (a0)+,d0
- beq.s .C
- cmp.b #" ",d0 search for space
- bne.s .D
- .E move.b (a0)+,d0
- cmp.b #" ",d0 check multiple spaces
- beq.s .E
- cmp.b #$22,-1(a0) check for "
- bne.s .G
- cmp.b #$22,-2(a1) surrounded by " " ?
- bne.s .G
- clr.b -2(a1)
- addq.l #1,a0
- .G lea set_defn(a3),a1 store definition
- .C subq.l #1,a0
- .F move.b (a0)+,(a1)+
- bne.s .F
- move.l a1,d4 D4=after end
- sub.l a3,a1 WORK OUT HOW BIG IS ACTUALLY
- move.l a1,d0
- moveq #1,d1
- bsr iwantmem allocate block big enough for everything
- beq.s .A
- move.l d0,a2
- move.l a1,set_size(a2)
- move.l first_set_defn(a5),d1
- move.l d1,(a2) new pts to old
- move.l a2,first_set_defn(a5)
- lea set_name(a2),a1 new block
- lea set_name(a3),a0 temp block
- .B move.b (a0)+,(a1)+
- cmp.l a0,d4
- bne.s .B
- .A moveq #RETURN_OK,d0
- rts
-
- check_if_set_already_there
- * A0= set name
- movem.l a0-a1,-(sp)
- lea temp2buf(a5),a1
- bsr cp_string
- bsr search_sets
- movem.l (sp)+,a0-a1
- rts
-
- deallocate_sets
- move.l first_set_defn(a5),d3
- beq no_sets_to_lose
- lose_next_set
- move.l d3,a1
- move.l (a1),-(sp)
- move.l set_size(a1),d0
- bsr givemem
- move.l (sp)+,d3
- bne lose_next_set
- no_sets_to_lose
- rts
-
- ConvertSemi ;convert \; into ; from/to CLIbuf
- lea CLIbuf(a5),a0
- move.l a0,a1
- moveq #0,d1
- .A move.b (a0)+,d0
- cmp.b #$5c,d1 ;\
- bne.s .D
- cmp.b #";",d0
- bne.s .D
- subq.l #1,a1
- .D move.b d0,(a1)+
- move.b d0,d1
- bne.s .A
- rts
-
- *************************
- * RESIDENT * V2.0:uses the GLOBAL resident-list
- ************************* (many things changed)
- residentz move.l parm2(a5),d0 SEE IF ANY PARAMETERS TYPED
- beq show_current_residents
- lea parm2(a5),a3
- move.l (a3),a0
- bsr return_dash_option
- cmp.b #'C',d0
- beq kill_resi
- next_resi move.l (a3)+,d0
- bne.s .B
- moveq #RETURN_OK,d0
- rts
- .B move.l d0,a4 A4=parmName
- move.l a3,-(sp)
- bsr spaths2 SEARCH PATHS FOR THE COMMAND
- move.l (sp)+,a3
- move.l d0,-(sp)
- move.l closecdir(a5),d1
- beq.s .G
- jsr _LVOUnLock(a6)
- clr.l closecdir(a5)
- .G move.l (sp)+,d0
- beq resi_not_found
- move.l d0,-(sp) push seglist
- move.l a4,a0
- move.l a4,a1
- bsr rempath SRC = DEST is OK
- bsr search_res2 find if same name is on resi list
- move.l (sp)+,d3
- move.l d0,d1
- bne.s .A
- bsr create_resi
- bra.s next_resi
- .A moveq #1,d0
- cmp.l resi_usecount(a0),d0
- bne.s resi_inuse
- move.l d0,resi_usecount(a0)
- move.l d3,resi_seglist(a0) new seglist
- jsr _LVOUnLoadSeg(a6) Unload old one with same name
- bra.s next_resi
-
- kill_resi tst.l (a3)+
- .B move.l (a3)+,d0
- bne.s .A
- moveq #RETURN_OK,d0
- rts
- .A move.l d0,a4
- move.l a4,a0
- move.l a4,a1
- bsr rempath SRC = DEST is OK
- bsr search_res2 find if same name is on resi list
- move.l d0,d1 gives d0,a0,d2
- beq.s resi_not_found
- moveq #1,d0
- cmp.l resi_usecount(a0),d0
- bne.s resi_inuse
- move.l a0,a2
- move.l d2,a0
- move.l resi_link(a2),resi_link(a0)
- clr.l resi_link(a2)
- jsr _LVOUnLoadSeg(a6) Unload old one with same name
- move.l a2,d1
- lsr.l #2,d1
- jsr _LVOUnLoadSeg(a6)
- bra.s .B
-
- resi_not_found
- move.l #205,d0
- bra.s resi_error
- resi_no_mem
- moveq #103,d0
- bra.s resi_error
- resi_inuse
- move.l #202,d0
- resi_error
- move.l dosbase(a5),a6
- bra pr_galactic
-
- create_resi ;D3:SegList, A4:Name
- moveq #resi_length,d0
- move.l a4,a0
- .A addq.l #1,d0 one more for lenght-byte
- tst.b (a0)+
- bne.s .A
- addq.l #4,d0 4 more for segment-length
- addq.l #7,d0 (7 more for and'ing needed by UnLoadSeg)
- moveq #-4,d1
- and.l d1,d0
- move.l d0,d2
- moveq #1,d1
- bsr iwantmem
- beq.s resi_no_mem
- addq.l #4,d0
- move.l d0,a2 D0=addr of resi_list_node
- move.l d2,-4(a2) save segment-length
- bsr do_forbid
- bsr resi_hand
- move.l d0,resi_link(a2)
- move.l a2,d0
- lsr.l #2,d0
- move.l d0,(a0)
- moveq #1,d0
- move.l d0,resi_usecount(a2)
- move.l d3,resi_seglist(a2)
- lea resi_name(a2),a1
- move.l a4,a0
- moveq #-1,d0
- bsr cpBSTR
- bsr do_permit
- moveq #0,d0
- rts
-
- resi_hand move.l dl_Root(a6),a0
- move.l rn_Info(a0),a0
- add.l a0,a0
- add.l a0,a0
- lea di_NetHand(a0),a0 NetHand in A0
- move.l (a0),d0 Start of Resi-List in D0
- rts
-
- show_current_residents
- lea residetx(pc),a1
- bsr pr_stringlf
- bsr rawh_off
- bsr resi_hand
- beq no_resis_to_show
- .A lsl.l #2,d0
- move.l d0,a3
- move.l resi_usecount(a3),d0
- subq.l #1,d0
- bsr print10
- bsr pr_space
- move.l a3,d0
- bsr printADR
- bsr pr_space
- lea resi_name(a3),a1
- moveq #0,d3
- move.b (a1)+,d3
- move.l a1,d2
- move.l outhandle(a5),d1
- beq.s .B
- jsr _LVOWrite(a6)
- bsr pr_lf
- .B bsr check_c
- bne.s no_resis_to_show
- move.l resi_link(a3),d0
- bne .A
- no_resis_to_show
- moveq #RETURN_OK,d0
- rts
-
- ****** Copy String from A0 to BSTR A1
- cpBSTR movem.l d1-d2/a0-a2,-(sp) max. Length-2 in D0
- lea 1(a1),a2
- moveq #0,d2
- bra.s .B
- .A move.b d1,(a2)+
- addq.l #1,d2
- .B move.b (a0)+,d1
- dbeq d0,.A
- clr.b (a2) ;NULL-end it
- move.b d2,(a1)
- move.l a1,d0
- lsr.l #2,d0
- movem.l (sp)+,d1-d2/a0-a2 D0 is BPTR to the BSTR
- rts
-
-
- *********************************
- * RPN CALCULATOR *
- *********************************
- evalz lea parm2(a5),a4
- move.l sp,d5 remember the stack ptr
- rpn_loop1 move.l (a4)+,d1
- beq show_rpn_result
- lea endofparms(a5),a1
- cmp.l a1,a4
- bhi show_rpn_result
- move.l d1,a1
- lea 8(sp),a0
- cmp.l a0,d5
- blo not_poke32
-
- cmp.b #'+',(a1)
- bne.s not_add
- move.l (sp)+,d0 DO ADD
- add.l d0,(sp)
- bra rpn_loop1
- not_add cmp.b #'-',(a1)
- bne.s not_sub
- move.l (sp)+,d0
- sub.l d0,(sp)
- bra rpn_loop1
-
- not_sub cmp.b #'*',(a1)
- bne.s not_mult
- move.l (sp)+,d0 last DO MULT
- move.l (sp)+,d1 2nd last
- bsr mult_32x32
- move.l d0,-(sp)
- bra rpn_loop1
- not_mult cmp.b #'/',(a1)
- bne.s not_div
- move.l (sp)+,d1 last DO DIVIDE
- move.l (sp)+,d0 2nd last
- tst.l d1
- beq rpn_error NO DIVIDE BY ZERO
- bsr div_32
- move.l d0,-(sp)
- bra rpn_loop1
- not_div cmp.b #'&',(a1)
- bne.s not_and
- move.l (sp)+,d0
- and.l d0,(sp)
- bra rpn_loop1
- not_and cmp.b #"|",(a1)
- bne.s not_or
- move.l (sp)+,d0
- or.l d0,(sp)
- bra rpn_loop1
- not_or cmp.b #'!',(a1)
- bne.s not_poke32
- move.l (sp)+,d0 GET ADDR DO POKE 32
- move.l (sp)+,d1 GET VALUE
- and.b #$fe,d0
- move.l d0,a0
- move.l d1,(a0)
- bra rpn_loop1
- not_poke32
- cmp.b #'@',(a1)
- bne.s not_peek32
- move.l (sp)+,d0 ADDR DO PEEK 32
- cmp.l sp,d5
- blo rpn_error
- and.b #$fe,d0
- move.l d0,a0
- move.l (a0),-(sp)
- bra rpn_loop1
-
- not_peek32
- bsr convert_ASCII_to_num
- beq rpn_error
- move.l d0,-(sp)
- bra rpn_loop1
- rpn_error move.l d5,sp
- rts
-
- show_rpn_result
- move.l (sp),-(sp)
- moveq #RETURN_ERROR,d7 error on equal
- tst.l (sp)
- beq.s .B
- bpl.s .C
- moveq #RETURN_WARN,d7 warn on minus
- bra.s .B
- .C moveq #RETURN_OK,d7 ok on plus
- .B lea (sp),a1
- move.l sp,a1
- lea rpn_result_tx(pc),a0 print hex & dec
- move.l outhandle(a5),d0
- cmp.l stdout(a5),d0 output redirected ?
- beq.s .A
- moveq #RETURN_OK,d7
- lea rpn_res2(pc),a0 print only number
- .A bsr new_print
- move.l d5,sp
- move.l d7,d0
- rts
-
- div_32 movem.l d2-d4,-(sp) ;d0=d0/d1
- moveq #0,d2
- moveq #31,d4
- _divu1 roxl.l #1,d0 ; divident
- roxl.l #1,d2 ; work accum
- cmp.l d1,d2 ; cmp with divisor
- blo.s _divu2
- sub.l d1,d2
- dc.l $003c0010 ;ori.b #16,CCR ;setx
- _divu2 roxl.l #1,d3 ; result
- dbf d4,_divu1
- move.l d3,d0
- move.l d2,d1
- movem.l (sp)+,d2-d4 ;result:d0 rest:d1
- rts
-
-
- mult_32x32
- * D1 = 32 bit, D0 = 32 bit (result)
- movem.l d1-d3,-(sp)
- move.l d0,d2
- move.l d0,d3
- mulu d1,d0 save intermediate result
- swap d3
- mulu d1,d3
- swap d3
- clr.w d3
- add.l d3,d0
- swap d1
- mulu d1,d2
- swap d2
- clr.w d2
- add.l d2,d0
- movem.l (sp)+,d1-d3
- rts
-
- * Convert null ending ASCII number(A1) to 32bit number in D0
- * Return D1=0 if bad number (a1:current pos)
- convert_ASCII_to_num
- movem.l d2/d3/a0,-(sp)
- moveq #0,d3 SET POSITIVE
- moveq #0,d1 RESET BASE
- .A cmp.b #'|',(a1)
- bne.s convnor
- lea 1(a1),a0
- bsr readfile
- cmp.w #NEWPRINTSIZE-2,d1
- bhs conversion_finished
- move.l d0,a0
- lea NewPrintBuffer(a5),a1
- move.l d1,d2
- subq.w #1,d2
- .B move.b (a0)+,(a1)+
- dbra d2,.B
- clr.b (a1)
- move.l d0,a1
- move.l d1,d0
- bsr givemem
- lea NewPrintBuffer(a5),a1
- ; bset #0,d3
- bra.s .A
- convnor moveq #0,d0 RESET RESULT
- moveq #0,d1 RESET BASE
- tst.b (a1)
- beq conversion_finished
- moveq #LF,d1 SET THE BASE
- cmp.b #'-',(a1) negative sign
- bne.s .A
- bset #3,d3
- .D addq.l #1,a1
- .A cmp.b #'+',(a1) positive sign
- beq.s .D
- cmp.b #'&',(a1) for APTR (hex!) -> BPTR
- bne.s .B
- addq.l #1,a1
- bset #1,d3
- moveq #16,d1 SET RADIX16
- bra same_base
- .B cmp.b #'§',(a1) for BPTR (hex!) -> APTR
- bne.s .C
- addq.l #1,a1
- bset #2,d3
- moveq #16,d1 SET RADIX16
- bra same_base
- .C cmp.b #'$',(a1)
- bne.s other_base
- move.b (a1)+,d2 DUMMY BUMP
- moveq #16,d1 SET RADIX16
- bra same_base
-
- other_base
- cmp.b #'%',(a1)
- bne.s same_base
- move.b (a1)+,d2
- moveq #2,d1 SET RADIX2
- same_base moveq #0,d2
- move.b (a1)+,d2
- beq conversion_finished
- bsr convert_D2_to_num
- tst.l d1
- beq.s conversion_finished
- bsr mult_32x32
- add.l d2,d0
- bra same_base
- conversion_finished
- btst #3,d3
- beq.s .A
- neg.l d0
- .A btst #1,d3
- beq.s .B
- lsr.l #2,d0
- .B btst #2,d3
- beq.s .C
- lsl.l #2,d0
- .C movem.l (sp)+,d2/d3/a0
- tst.b d1
- rts
-
- convert_D2_to_num
- cmp.b #'0',d2
- blo.s bad_number
- cmp.b #'9',d2
- bhi.s check_hex
- sub.b #'0',d2
- rts
- check_hex cmp.b #16,d1
- bne.s bad_number
- cmp.b #'f',d2
- bhi.s bad_number
- cmp.b #'A',d2
- blo.s bad_number
- cmp.b #'F',d2
- bhi.s check_upper_hex
- sub.b #55,d2
- rts
- check_upper_hex
- cmp.b #'a',d2
- blo.s bad_number
- sub.b #87,d2
- rts
- bad_number
- moveq #0,d1 FLAG ERROR thru silly base
- rts
-
- *********************************
- * MEMORY EXAMINE *
- *********************************
- memexamz clr.l mem_offset_addr(a5)
- moveq #0,d7
- tst.l parm2(a5) CHECK IF NO ADDRESS.
- bne.s .E
- moveq #8,d7
- bra show_mempage
- .E bsr fixpam32
- tst.b (a1)
- beq.s .A
- move.l a0,-(sp)
- bsr convert_ASCII_to_num convert 2nd num
- move.l (sp)+,a0
- tst.b d1
- beq bad_number_error
- move.l d0,d7 D7=2nd num
- .A move.l a0,a1
- bsr convert_ASCII_to_num convert 1st num
- beq bad_number_error
- .C tst.l d7
- bne.s .D
- moveq #8,d7
- bra.s memex2
- .D sub.l d0,d7
- lsr.l #4,d7
- addq.l #1,d7
-
- memex2 move.l d0,mem_addr(a5)
- show_mempage
- and.b #$fe,mem_addr+3(a5) MAKE SURE EVEN ADDRESS
- shmem2 bsr check_c
- bne .A
- bsr show_16_locs
- subq.l #1,d7 D7=count
- bne.s shmem2
- .A moveq #RETURN_OK,d0
- rts
-
- show_16_locs
- move.l mem_addr(a5),a1
- lea CLIbuf(a5),a3
- move.l a3,a0
- moveq #15,d0
- sh_16_1 move.b (a1)+,d1
- move.b #'.',(a0)+
- move.b d1,d2
- bclr #7,d2
- cmp.b #' ',d2
- blo.s sh_16_2
- move.b d1,-1(a0)
- sh_16_2 dbra d0,sh_16_1
- clr.b (a0)
- move.l a3,-(sp) PUSH STRING ADDR
- move.l -(a1),-(sp) PUSH LAST BYTES
- move.l -(a1),-(sp)
- move.l -(a1),-(sp)
- move.l -(a1),-(sp) PUSH FIRST BYTES
- move.l mem_addr(a5),d0
- sub.l mem_offset_addr(a5),d0
- move.l d0,-(sp)
- lea mem_line(pc),a0
- lea (sp),a1
- bsr new_print
- movem.l (sp)+,d0-d5 DUMMY
- add.l #16,mem_addr(a5)
- rts
-
- * ENTRY A0=FORMATSTRING A1=DATASTREAM.
- new_print ;v2.0 small data
- movem.l d0-d3/a0-a3,-(sp)
- lea NewPrintBuffer(a5),a3 ;V2.0 not on stack
- lea KPutChar(pc),a2
- move.l 4.w,a6
- jsr _LVORawDoFmt(a6)
- move.l dosbase(a5),a6
- move.l outhandle(a5),d1
- beq.s .B
- lea NewPrintBuffer(a5),a0
- move.l a0,d2
- moveq #-1,d3
- .A addq.l #1,d3
- tst.b (a0)+
- bne.s .A
- jsr _LVOWrite(a6)
- .B movem.l (sp)+,d0-d3/a0-a3
- rts
-
- KPutChar move.b d0,(a3)+
- rts
-
- GetDiskInfo ;device-task must be in packettask(a5), gets info to a5
- bsr clearArgs
- moveq #ACTION_DISK_INFO,d0
- move.l d0,packettype(a5)
- move.l a5,d0
- lsr.l #2,d0
- move.l d0,myArg1(a5) use FIB as INFO (bptr)
- bsr sendpacket
- rts
- sub.l a0,a0
- tst.l sp_res1(a5)
- beq.s .A
- move.l id_VolumeNode(a5),a0 it is in here !
- .A rts
-
- CountLocks ;Exit: d0=number of all locks in system
- movem.l d1/d2/a2,-(sp)
- clr.l temp3(a5)
- bsr do_forbid
- bsr get_first_devinfo
- .D moveq #dlt_device,d1
- bsr find_next_assign walk through dos-list
- tst.l d0
- bne.s .C
- move.l 8(a0),packettask(a5) task
- beq.s .D was non-disk-device
- bsr GetDiskInfo
- move.l id_InUse(a5),d0 lock
- beq.s .D
- .A addq.l #1,temp3(a5) count locks
- lsl.l #2,d0
- move.l d0,a0
- move.l (a0),d0
- bne.s .A
- bra.s .D
- .C bsr do_permit
- move.l temp3(a5),d0
- movem.l (sp)+,d1/d2/a2
- rts
-
- ** SAVE STATS store current time in date mark, and current memory use in mem mark
- save_time
- movem.l d0-d1/a0,-(sp)
- lea date_mark(a5),a0
- bsr get_time
- movem.l (sp)+,d0-d1/a0
- rts
- save_mem movem.l d0-d1/a0-a1,-(sp)
- clr.l temp2(a5)
- btst #FLcheck,Flags+3(a5)
- beq.s .C
- move.l 4.w,a0
- tst.w 296(a0) CPU better than 68000 ?
- bne.s .A
- move.l #1024,d0 no, store lower memory
- moveq #1,d1
- bsr iwantmem
- move.l d0,temp2(a5)
- beq.s .A
- move.l d0,a1
- sub.l a0,a0 adress 0 to 1023
- move.l #1024/4-1,d0
- .B move.l (a0)+,(a1)+
- dbra d0,.B
- .A bsr CountLocks
- lea mem_mark(a5),a0
- bsr memory_info remember memory usage
- .C movem.l (sp)+,d0-d1/a0-a1
- rts
-
- ** DISPLAY TIME ELAPSED SINCE LAST CALL TO SAVE TIME AND
- ** ALSO CHANGE IN MEMORY AVAILABLE. EXPECTS RETURN CODE TO BE ABOVE RETURN
- ** ADDRESS ON STACK ie 4(sp)
- show_status
- lea -34(sp),sp
- lea (sp),a0 A0=time area
- move.l Result2(a5),(a0)+ -4(a0) ioerr-result
- bsr get_time
- lea date_mark(a5),a1
- move.l ds_Tick(a0),d0
- sub.l ds_Tick(a1),d0
- bpl.s no_tick_carry
- add.l #3000,d0
- subq.l #1,ds_Minute(a0)
- no_tick_carry
- move.l d0,ds_Tick(a1) store in datemark
- move.l ds_Minute(a0),d0
- sub.l ds_Minute(a1),d0
- move.l d0,ds_Minute(a1)
- bsr convert_time A0=4+3 words of time
- do_mem_deltas
- lea 14(a0),a0
- bsr memory_info
- lea mem_mark(a5),a1
- move.l (a1),d0
- sub.l d0,(a0) subtract old from new ;chip
- move.l 4(a1),d0
- sub.l d0,4(a0) ;fast
- move.l 8(a1),d0
- sub.l d0,8(a0) ;total
- lea -12(a0),a1
- move.l -18(a0),(a1)
- lea stat_text(pc),a0
- bsr new_print
- lea 34(sp),sp
- move.l temp3(a5),d1 check for forgotten locks
- bsr CountLocks
- cmp.l d1,d0
- beq.s .D
- exg.l d0,d1
- movem.l d0/d1,-(sp)
- move.l sp,a1
- lea lockleft(pc),a0
- bsr new_print
- addq.l #8,sp
- .D move.l temp2(a5),d0
- beq.s .A
- move.l d0,a1 show changes of low memory
- sub.l a0,a0
- move.l #1024/4-1,d0
- .B move.l (a0)+,d1
- cmp.l (a1)+,d1
- beq.s .C
- movem.l a0-a1,-(sp)
- move.l -4(a0),-(sp)
- move.l -4(a1),-(sp)
- move.l a0,-(sp)
- subq.l #4,(sp)
- move.l sp,a1
- lea lowmemtx(pc),a0 print the changes
- bsr new_print
- lea 12(sp),sp
- movem.l (sp)+,a0-a1
- .C dbra d0,.B
- move.l temp2(a5),a1
- move.l #1024,d0
- bsr givemem
- .A rts
-
- *************************
- * DATE/TIME *
- *************************
- datez lea date_mark(a5),a2
- move.l a2,a0
- bsr get_time
- move.l a2,a1
- lea -14(sp),sp
- lea (sp),a0
- bsr convert_time
- tst.l parm2(a5)
- beq.s .A
- lea parm2(a5),a0
- lea (sp),a1
- bsr.s settime
- lea 14(sp),sp
- bne.s .B
- bsr tset
- clr.l parm2(a5)
- bra.s datez ;now print date/time
- .A lea (sp),a1
- lea time_text(pc),a0
- bsr new_print
- lea 14(sp),sp
- moveq #RETURN_OK,d0
- .B rts
-
- settime movem.l d1-d4/a0-a4,-(sp) V2.0
- move.l a0,a4 ;a0=parameters
- move.l a1,temp1(a5) ;a1=date/time
- settim move.l (a4)+,a0
- lea temp2buf(a5),a2
- moveq #2,d3
- aa1 move.l a0,a1
- bsr gab
- move.b d0,d4
- beq.s bb1
- clr.b -1(a0)
- cmp.b #".",d0 ;day.month.year
- bne.s dat2
- bb1 bsr convert_ASCII_to_num
- cmp.w #99,d0 ;rough check
- bhi muell
- move.w d0,(a2)+
- tst.l d1
- beq muell
- tst.b d4
- dbeq d3,aa1
- mull1 tst.w d3
- bne muell
- lea temp2buf(a5),a2
- move.l temp1(a5),a1
- moveq #2,d3
- .B move.w (a2)+,(a1)+
- dbra d3,.B
- bra oktt
- aa2 move.l a0,a1
- bsr gab
- move.b d0,d4
- beq.s bb2
- clr.b -1(a0)
- dat2 cmp.b #":",d0 ;hour:minute:second
- bne.s dat3
- bb2 bsr convert_ASCII_to_num
- cmp.w #99,d0
- bhi muell
- move.w d0,(a2)+
- tst.l d1
- beq muell
- tst.b d4
- dbeq d3,aa2
- mull2 tst.w d3
- bne muell
- lea temp2buf(a5),a2
- move.l temp1(a5),a1
- lea 6(a1),a1
- moveq #2,d3
- .B move.w (a2)+,(a1)+
- dbra d3,.B
- bra oktt
- moveq #2,d3
- aa3 move.l a0,a1
- bsr gab
- move.b d0,d4
- beq.s bb3
- clr.b -1(a0)
- dat3 cmp.b #"-",d0 ;month-day-year
- bne muell
- bb3 bsr convert_ASCII_to_num
- cmp.w #99,d0
- bhi muell
- move.w d0,(a2)+
- tst.l d1
- beq muell
- tst.b d4
- dbeq d3,aa3
- mull3 tst.w d3
- bne muell
- lea temp2buf(a5),a2
- move.l temp1(a5),a1
- move.w (a2)+,2(a1)
- move.w (a2)+,(a1)
- move.w (a2)+,4(a1)
- oktt tst.l (a4)
- bne settim
- lea chaotab(pc),a0
- move.l temp1(a5),a1
- lea temp2buf(a5),a3
- moveq #5,d0
- moveq #0,d1
- .A move.b (a0)+,d1
- move.w 0(a1,d1),d2
- move.b d2,(a3)+
- dbra d0,.A
- lea temp2buf(a5),a3
- bsr calcsec
- movem.l (sp)+,d1-d4/a0-a4
- moveq #RETURN_OK,d0
- rts ;result in d5-d7
-
- muell lea muell_tx(pc),a1
- bsr pr_stringlf
- movem.l (sp)+,d1-d4/a0-a4
- moveq #RETURN_ERROR,d0
- rts
-
- gab move.b (a0)+,d0
- cmp.b #$30,d0
- blo.s .A
- cmp.b #$39,d0
- bls.s gab
- .A cmp.b #"%",d0 ;handle bin (that's fun !)
- beq.s gab
- rts
-
- ** GET TIME STORE DAYS,MINUTES,TICKS AT A0
- get_time move.l a0,-(sp)
- move.l a0,d1
- jsr _LVODateStamp(a6)
- move.l (sp)+,a0
- rts
-
- ** ENTRY A0 pts to 7 words of storage, A1 pts to date stamp
- ** send time to A0 --> 13(A0)
- convert_time
- movem.l d0-d3/a0-a2,-(sp)
- move.l ds_Tick(a1),d0
- divu #50,d0
- move.w d0,4+6(a0) seconds
- swap d0
- asl.w #1,d0
- move.w d0,6+6(a0) hundredths
- move.l ds_Minute(a1),d0
- divu #60,d0
- move.w d0,0+6(a0) hours
- swap d0
- move.w d0,2+6(a0) minutes
- move.l ds_Days(a1),d0
- move.w #365,d1 V2.0:year, day, month
- move.w #77,d2
- wdhj addq.w #1,d2
- sub.w d1,d0
- bcs.s mon
- move.w d2,d3
- and.w #3,d3
- bne.s wdhj
- cmp.w #100,d2
- blo.s ork
- moveq #1,d3
- addq.w #1,d0
- sub.w #100,d2
- ork subq.w #1,d0
- bcc.s wdhj
- addq.w #1,d0
- mon add.w d1,d0
- move.w d2,4(a0) year (lots of work)
- moveq #0,d2
- lea montab(pc),a2
- wdhm addq.w #1,d2
- moveq #0,d1
- move.b (a2)+,d1
- sub.w d1,d0
- bcs.s tag
- cmp.w #2,d2
- bne.s wdhm
- move.w 4(a0),d3
- beq.s wdhm
- and.w #3,d3
- bne.s wdhm
- subq.w #1,d0
- bcc.s wdhm
- addq.w #1,d0
- tag add.w d1,d0
- addq.w #1,d0
- move.w d2,2(a0) month (i don't like february)
- move.w d0,(a0) day
- movem.l (sp)+,d0-d3/a0-a2
- rts
-
- montab dc.b 31,28,31,30,31,30,31,31,30,31,30,31
-
- *************************
- * STACK *
- *************************
- stackz move.l CLIptr(a5),a4
- move.l cli_DefaultStack(a4),d7
- lsl.l #2,d7
- tst.l parm2(a5)
- beq.s show_stack
- move.l parm2(a5),a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- stk_num_OK
- move.l d0,d6
- cmpi.l #1600,d6 ;allow 1600 bytes for DOS
- blt.s stoosmall
- move.l d6,d0
- moveq #1,d1
- bsr iwantmem
- beq.s stoobig
- move.l d0,a1
- move.l d6,d0
- bsr givemem
-
- lsr.l #2,d6
- move.l d6,cli_DefaultStack(a4)
- moveq #RETURN_OK,d0
- rts
- stoosmall
- lea stk_too_small_tx(pc),a1
- moveq #RETURN_ERROR,d0
- bra pr_string
- stoobig
- moveq #103,d0
- bra pr_galactic
- show_stack
- move.l d7,-(sp)
- lea (sp),a1
- lea stk_size_tx(pc),a0
- bsr new_print
- move.l (sp)+,d0
- moveq #RETURN_OK,d0
- rts
-
- ** CHECK STRING A0 IF ENDING IN :
- ** RETURN EQ IF DOES END IN COLON
- check_for_colon
- .A tst.b (a0)+ MAKE SURE ENDS IN :
- bne.s .A
- move.b -2(a0),d0
- cmp.b #':',d0
- rts
-
- do_forbid move.l 4.w,a6
- jsr _LVOForbid(a6)
- move.l dosbase(a5),a6
- rts
- do_permit move.l 4.w,a6
- jsr _LVOPermit(a6)
- move.l dosbase(a5),a6
- rts
-
- *************************
- * ASSIGN *
- *************************
- assignz cmp.w #36,kickver(a5)
- blo assi13
- tst.l parm2(a5)
- beq assi13
- move.l parm3(a5),d2
- beq too_less_args
- move.l parm2(a5),a2
- move.l a2,a0
- bsr check_for_colon
- bne.s .G
- clr.b -2(a0) no colon-end
- .G lea assignuse(pc),a1
- move.l parm4(a5),d0
- bne.s .B
- move.l d2,a0
- bsr CheckOpt
- beq.s .C
- move.l d2,d1 Assign LOCK
- moveq #-2,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- move.l d0,d2
- beq DOSerr
- move.l a2,d1
- jsr _LVOAssignLock(a6)
- tst.l d0
- beq DOSerrUL
- bra .A
- .C move.l a2,d1 Assign REMOVE
- moveq #0,d2
- jsr _LVOAssignLock(a6)
- tst.l d0
- beq DOSerr
- bra.s .A
-
- .B move.l d0,a0
- bsr CheckOpt
- bne.s .H
- move.l d2,d1 Assign REMOVE part
- moveq #-2,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- move.l d0,d2
- beq DOSerr
- move.l a2,d1
- jsr _LVORemAssignList(a6)
- tst.l d0
- beq DOSerrUL
- bra.s .A
- .H bsr CheckOpt
- bne.s .D
- move.l d2,d1 Assign ADD
- moveq #-2,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- move.l d0,d2
- beq DOSerr
- move.l a2,d1
- jsr _LVOAssignAdd(a6)
- tst.l d0
- beq DOSerrUL
- bra.s .A
- .D bsr CheckOpt
- bne.s .E
- move.l a2,d1 Assign PATH
- jsr _LVOAssignPath(a6)
- tst.l d0
- beq DOSerr
- bra.s .A
- .E bsr CheckOpt
- bne.s .F
- move.l a2,d1 Assign DEFER
- jsr _LVOAssignLate(a6)
- tst.l d0
- beq DOSerr
- bra.s .A
- .F lea assignuse(pc),a1
- bsr pr_stringlf
- .A moveq #RETURN_OK,d0
- rts
-
- assi13 bsr do_forbid FORBID
- bsr get_first_devinfo
- tst.l parm2(a5)
- beq show_assigns
- tst.l parm3(a5)
- beq exit_assignf ONLY TWO PARMS TYPED (NEED 3)
- move.l parm2(a5),a0
- bsr check_for_colon
- beq assi14
- bsr do_permit
- no_col move.l #210,d0
- bra pr_galactic
-
- assi14 moveq #dlt_directory,d1 CREATE/MODIFY ASSIGN ******
- bsr find_next_assign
- tst.l d0
- bne no_more_dir_assigns
- move.l a0,d5
- move.l parm2(a5),a0 A0=assigned name[0]
- moveq #0,d2
- move.b (a1)+,d2 get char count
- .A move.b (a1)+,d0
- move.b (a0)+,d1
- beq.s assi14
- subq.l #1,d2
- bmi.s .C
- bsr compD1D0nocase
- beq.s .A
- .D bra.s assi14
-
- .C cmp.b #':',d1 CHANGE EXISTING
- bne.s .D
- bsr do_permit PERMIT
- move.l d5,a2 GOT A MATCH
- moveq #ACCESS_READ,d2
- move.l parm3(a5),d1
- jsr _LVOLock(a6)
- tst.l d0
- beq exit_assignp
- move.l d0,a3
- bsr do_forbid FORBID
- move.l dvi_Lock(a2),d4
- move.l a3,dvi_Lock(a2) new lock
- add.l a3,a3
- add.l a3,a3
- move.l fl_Task(a3),dvi_Task(a2)
- clr.l dvi_Handler(a2)
- clr.l dvi_StackSize(a2)
- clr.l dvi_Priority(a2)
- clr.l dvi_Startup(a2)
- clr.l dvi_SegList(a2)
- clr.l dvi_GlobVec(a2)
- bsr do_permit
- move.l d4,d1
- jsr _LVOUnLock(a6)
- bra exit_assignp
-
- no_more_dir_assigns
- bsr do_permit CREATE NEW ASSIGN
- moveq #48,d0
- move.l #MEMF_CLEAR+1,d1
- bsr iwantmem
- beq exit_assignp
- move.l d0,a4
- move.l #48,(a4)+ save size byte
- move.l parm2(a5),a0
- moveq #4,d0 4+1 extra bytes for dos(nb: : is ignored)
- .A addq.l #1,d0
- tst.b (a0)+
- bne.s .A
- move.l d0,d3 D3=size+5+1 (block size|char_count|chars)
- moveq #1,d1
- bsr iwantmem
- beq rem_dvi
- move.l d0,a3
- move.l d0,d4 D4=string ptr
- move.l d3,(a3)+ save size byte
- subq.l #6,d3
- move.b d3,(a3)+ save char_count
- move.l parm2(a5),a0
- bra.s .C
- .B move.b d1,(a3)+ copy string to NAME
- .C move.b (a0)+,d1
- cmp.b #':',d1
- bne.s .B
- clr.b (a3) ;NULL-ending V2.0
- addq.l #4,d0
- lsr.l #2,d0 convert to bstr
- move.l d0,dvi_Name(a4)
- move.l #dlt_directory,dvi_Type(a4)
- moveq #ACCESS_READ,d2
- move.l parm3(a5),d1
- jsr _LVOLock(a6)
- tst.l d0
- beq rem_str
- move.l d0,dvi_Lock(a4)
- lsl.l #2,d0 x 4
- move.l d0,a0
- move.l fl_Task(a0),dvi_Task(a4)
- bsr do_forbid
- bsr get_first_devinfo RETURNS A1 pts info substr, A2 pts 1st devinfo
- move.l a2,dvi_Next(a4)
- move.l a4,d0
- lsr.l #2,d0
- move.l d0,di_DevInfo(a1) Insert new top of chain
- bsr do_permit
-
- bra.s exit_assignp
- rem_str move.l d4,a1
- move.l (a1),d0
- bsr givemem
- rem_dvi lea -4(a4),a1
- moveq #48,d0
- bsr givemem
- exit_assignp
- moveq #RETURN_OK,d0
- rts
- exit_assignf
- bsr do_permit
- moveq #RETURN_OK,d0
- rts
-
- * SHOW ASSIGNS ALREADY IN FORBID STATE
- show_assigns
- lea -8(sp),sp
- move.l a2,(sp) 0(sp)= BPTR of first devinfo
- move.l #5000,d0
- moveq #1,d1
- bsr iwantmem allocate big block
- beq asg_fail
- move.l d0,a4 A4 = string block
- move.l d0,a3
- add.l #5000,a3 A3 = end of string block
- move.l d0,4(sp) 4(sp) = string block
- lea volume_tx(pc),a0 PRINT VOLUMES:
- bsr copy_name
- moveq #dlt_volume,d1
- do_volumes
- .E bsr find_next_assign COPY ALL DEVICES THAT MATCH TYPE IN D1
- tst.l d0 TO THE BIG STRING
- bne.s do_devices
- bsr copy_bstr
- move.b #$20,(a4)+ seperate with spaces
- tst.l dvi_Task(a0)
- beq.s .H
- lea mounted_tx(pc),a0
- bsr copy_name
- .H move.b #LF,(a4)+
- bra.s .E
- do_devices
- move.l (sp),a2 restart at first devinfo
- lea device_tx(pc),a0 PRINT DEVICES:
- bsr copy_name
- moveq #dlt_device,d1
- .B bsr find_next_assign COPY ALL DEVICES THAT MATCH TYPE IN D1
- tst.l d0 TO THE BIG STRING
- bne.s .A
- bsr copy_bstr
- move.b #$20,(a4)+ seperate with spaces
- move.b #$20,(a4)+
- bra.s .B
- .A move.b #LF,(a4)+ linefeed at end
- move.l (sp),a2
- do_late
- lea assign_tx(pc),a0 PRINT DIRECTORIES
- bsr copy_name
- moveq #dlt_late,d1
- .B bsr find_next_assign COPY ALL DEVICES THAT MATCH TYPE IN D1
- tst.l d0 TO THE BIG STRING
- bne.s .A
- bsr copy_bstr
- move.b #":",(a4)+
- move.b #9,(a4)+ seperate with tab
- move.b #"<",(a4)+
- move.l dvi_Handler(a0),a0
- bsr copy_name
- move.b #">",(a4)+
- move.b #LF,(a4)+ linefeed at end
- bra.s .B
- .A move.l (sp),a2
- do_nonbind
- moveq #dlt_nonbind,d1
- .B bsr find_next_assign COPY ALL DEVICES THAT MATCH TYPE IN D1
- tst.l d0 TO THE BIG STRING
- bne.s .A
- bsr copy_bstr
- move.b #":",(a4)+
- move.b #9,(a4)+ seperate with tab
- move.b #"[",(a4)+
- move.l dvi_Handler(a0),a0
- bsr copy_name
- move.b #"]",(a4)+
- move.b #LF,(a4)+ linefeed at end
- bra.s .B
- .A move.l (sp),a2
- do_dirs ;uses top of big mem block (end in a3)
- move.w #-1,-(a3) push negative
- .G moveq #dlt_directory,d1
- bsr find_next_assign COPY ALL DEVICES THAT MATCH TYPE IN D1
- tst.l d0 TO THE BIG STRING
- bne.s .E
- clr.l -(a3) null-end locks
- cmp.w #36,kickver(a5)
- blo.s .A OS1.3-: no assign add
- move.l dvi_LockList(a0),d0 search locklist (assign add)
- beq.s .A
- .B move.l d0,a1
- move.l 4(a1),-(a3) push locks
- move.l (a1),d0
- bne.s .B
- .A move.l d2,-(a3) push main lock
- clr.b -(a3) null-end name
- move.l dvi_Name(a0),a1
- add.l a1,a1
- add.l a1,a1
- moveq #0,d0
- move.b (a1),d0 name-length
- btst #0,d0
- bne.s .C
- clr.b -(a3) for word-align
- .C add.l d0,a1
- addq.l #1,a1 a3=end of name
- bra.s .D
- .F move.b -(a1),-(a3)
- .D dbra d0,.F
- bra.s .G
-
- .E bsr do_permit
- get_nxt_lock
- cmp.b #$ff,(a3) check for end
- beq.s .A
- move.l a3,a0
- bsr copy_name copy assign-name
- .B tst.b (a3)+ look for end
- bne.s .B
- move.b #9,(a4)+ copy tab
- move.l a3,d0
- addq.l #1,d0
- and.w #$fffe,d0 word-align
- move.l d0,a3
- move.l (a3)+,d1 first lock
- beq.s .F
- bra.s .G
- .C move.l (a3)+,d1
- beq.s get_nxt_lock
- move.b #9,(a4)+ other locks are assign adds
- move.b #"+",(a4)+
- move.b #" ",(a4)+
- .G move.l d1,a0
- add.l a0,a0
- add.l a0,a0
- move.l fl_Volume(a0),a0
- add.l a0,a0
- add.l a0,a0
- tst.l dvi_Task(a0) check for mounted
- bne.s .E
- .F lea unmounted_tx(pc),a0
- bsr copy_name
- bra.s get_nxt_lock
- .E jsr _LVODupLock(a6) copy lock(D1) --> (D0)
- tst.l d0
- beq.s .F could not dup lock
- move.l a4,a0
- move.l a3,-(sp)
- bsr eval_full_path write path to big block
- move.l (sp)+,a3
- jsr _LVOUnLock(a6)
- .D tst.b (a4)+ look for end
- bne.s .D
- move.b #LF,-1(a4) overwrite null or tab
- bra.s .C
- .A clr.b (a4) null-end
-
- move.l a4,d6
- subq.l #1,d6
- move.l 4(sp),a4
- bsr rawh_off
- bsr pr_screen
- move.l 4(sp),a1
- move.l #5000,d0
- bsr givemem
- bra.s asg_fail2
- asg_fail bsr do_permit
- asg_fail2 lea 8(sp),sp
- moveq #RETURN_OK,d0
- rts
-
-
- get_first_devinfo
- move.l dl_Root(a6),a1
- move.l rn_Info(a1),a1
- add.l a1,a1
- add.l a1,a1
- move.l di_DevInfo(a1),a2 A2=BPTR to first devinfo
- rts
-
- copy_name move.b (a0)+,(a4)+
- bne.s copy_name
- lea -1(a4),a4
- rts
-
- **COPY BSTR FROM A1 TO A4, DONT NULL END
- copy_bstr move.b (a1)+,d0
- bra.s .C
- .B move.b (a1)+,(a4)+
- .C dbra d0,.B
- rts
-
- **ENTRY: D1=type ,A2=Bptr of devinfo, EXIT: A2=Bptr to next ,D0=0 if found
- **EXIT: D2=lock, D1=type, A1 pts to string, A0 pts devinfo struct
- find_next_assign
- .A add.l a2,a2 FIND NEXT DEVINFO THAT MATCHES THE TYPE (D1)
- add.l a2,a2 A2 pts to first devinfo structure
- move.l a2,d0 tst.l (a2)
- beq.s .B
- move.l a2,a0
- move.l dvi_Name(a2),a1
- move.l dvi_Lock(a2),d2
- move.l dvi_Type(a2),d0
- move.l (a2),a2
- cmp.l d0,d1
- bne.s .A
- add.l a1,a1
- add.l a1,a1
- moveq #0,d0
- rts
- .B moveq #1,d0
- rts
-
- bad_number_error
- movem.l a0-a1,-(sp)
- cmp.w #36,kickver(a5)
- blo.s .A
- moveq #115,d0
- bsr pr_DOSerr
- bra.s .B
- .A lea bad_number_tx(pc),a1
- bsr pr_stringlf
- .B movem.l (sp)+,a0-a1
- moveq #RETURN_ERROR,D0
- rts
-
- *************************
- * FAILAT *
- *************************
- failatz move.l parm2(a5),d0
- beq.s .A
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq.s bad_number_error
- move.l CLIptr(a5),a0
- move.l d0,cli_FailLevel(a0)
- bra.s .B
- .A move.l CLIptr(a5),a0
- lea cli_FailLevel(a0),a1
- lea failat_tx(pc),a0
- bsr new_print
- .B moveq #RETURN_OK,d0
- rts
-
- *************************
- * IF *
- *************************
- ifz move.b #$ff,if_flag(a5)
- move.b #$ff,if_condition(a5) set FALSE
- lea parm2(a5),a4
- moveq #0,d4 not state
- .C move.l (a4)+,d0
- beq if_fail
- move.l d0,a0
- lea not_tx(pc),a1
- bsr compare_strings
- bne.s .B
- not.b d4 set D4=FF if not
- bra .C
- .B lea exists_tx(pc),a1
- bsr compare_strings
- bne.s try_warn IF NOT AN EXISTS TYPE COMPARE
- move.l (a4)+,d1
- beq if_fail
- moveq #0,d3 d3=0 doesnt exist
- moveq #ACCESS_READ,d2
- jsr _LVOLock(a6)
- tst.l d0
- beq.s save_state
- move.l d0,d1
- jsr _LVOUnLock(a6)
- not.b d3 d3=ff exists
- save_state
- not.b d3 d3=0 true
- eor.b d4,d3
- move.b d3,if_condition(a5)
- moveq #RETURN_OK,D0
- RTS
- try_warn move.l last_failcode(a5),d5
- moveq #RETURN_WARN,d6
- lea warn_tx(pc),a1 CHECK IF 'IF WARN'
- bsr compare_strings
- bne try_error
- set_error_state
- moveq #0,d3
- cmp.l d6,d5
- bne save_state
- not.b d3
- bra save_state
- try_error lea error_tx(pc),a1
- bsr compare_strings
- bne try_fail
- moveq #RETURN_ERROR,d6
- bra set_error_state
- try_fail lea fail_tx(pc),a1
- bsr compare_strings
- bne if_fail
- moveq #RETURN_FAIL,d6
- bra set_error_state
- if_fail not.b if_flag(a5) clear it
- lea if_error_tx(pc),a1
- bsr pr_string
- MOVEQ #RETURN_ERROR,D0
- RTS
-
- *************************
- * ASK *
- *************************
- askz bsr echoz print the parm same as echo does
- rask bsr raw_off
- move.l stdin(a5),d1
- beq.s .A
- lea tempbuf(a5),a4 a4:tempbuf
- clr.b (a4)
- move.l a4,d2
- moveq #120,d3
- jsr _LVORead(a6) read input
- tst.l d0
- bmi.s .A
- beq.s .A
- move.l outhandle(a5),d1
- cmp.l stdout(a5),d1 output redirected ?
- beq.s .C
- move.l a4,a0
- add.l d0,a0
- subq.l #1,a0
- clr.b (a0) Null-End
- move.l a4,a1
- bsr pr_string repeat input
- bra .A
- .C or.b #$20,(a4)
- moveq #RETURN_FAIL,d0
- cmp.b #'f',(a4) V2.0
- beq .B
- moveq #RETURN_ERROR,d0
- cmp.b #'e',(a4) V2.0
- beq .B
- moveq #RETURN_WARN,d0
- cmp.b #'j',(a4) V2.0
- beq .B
- cmp.b #'y',(a4)
- beq .B
- .A moveq #RETURN_OK,D0
- .B rts
-
- *************************
- * WAIT *
- *************************
- waitz move.l parm2(a5),d0
- beq too_less_args
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- move.l d0,d4
- lsl.l #2,d4 d4*4
- add.l d0,d4 d4:=d0*5 (d4*4+d4)
- .C bsr check_c
- bne.s .E
- moveq #LF,d1 1/5 second
- jsr _LVODelay(a6)
- subq.l #1,d4
- bne.s .C
- .E moveq #RETURN_OK,D0
- RTS
-
- *************************
- * QUIT *
- *************************
- * only returns from script files.
- quitz tst.b scflag(a5)
- bne.s .A
- moveq #RETURN_OK,D0
- RTS
- .A move.l parm2(a5),d0
- beq .B
- move.l d0,a1
- bsr convert_ASCII_to_num
- bne .B
- bsr bad_number_error
- .B move.l d0,-(sp)
- bsr kill_script guarantee that script is dead
- move.l (sp)+,d0
- rts
-
- *************************
- * HTYPE *
- *************************
- htypez move.l parm2(a5),d1
- beq too_less_args
- move.l d1,a0
- bsr readfile
- move.l d0,mem_addr(a5)
- move.l d0,mem_offset_addr(a5)
- move.l d1,temp1(a5)
- add.l d0,d1
- move.l d1,d7 end marker
- bsr rawh_off
- .B bsr check_c
- bne htype_end
- bsr show_16_locs
- cmp.l mem_addr(a5),d7
- bhi .B
- htype_end move.l mem_offset_addr(a5),a1
- move.l temp1(a5),d0
- bsr givemem
- moveq #RETURN_OK,D0
- RTS
-
- *************************
- * STRINGS *
- *************************
- stringsz move.l parm2(a5),d0
- beq too_less_args
- moveq #7,d7 default 7
- move.l parm3(a5),d0
- beq.s .B
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq bad_number_error
-
- move.l d0,d7 D7=min_string
- .B move.l parm2(a5),a0
- bsr readfile
- move.l d0,a4 A4=addr of file
- move.l a4,a3
- move.l d1,d6 D6=size of file
- add.l d0,d1
- move.l d1,d4 D4=max addr
- movem.l d4-d7/a3-a4,-(sp)
- bsr rawh_off
- movem.l (sp)+,d4-d7/a3-a4
- str_next bsr check_c
- bne kill_string_file
- moveq #0,d5 D5=current string size
- move.l a3,a2
- valid_ch cmp.l a3,d4
- beq string_fin
- move.b (a3)+,d0
- cmp.b #' ',d0
- blo.s not_valid_char
- cmp.b #$7f,d0
- bhi.s not_valid_char
- addq.l #1,d5
- bra valid_ch
- not_valid_char
- cmp.l d7,d5
- blo str_next
- bsr write_my_string
- bra str_next
-
- string_fin
- cmp.l d7,d5
- blo kill_string_file
- bsr write_my_string
- kill_string_file
- move.l a4,a1
- move.l d6,d0
- bsr givemem
- moveq #RETURN_OK,D0
- RTS
-
- write_my_string
- move.l outhandle(a5),d1
- beq.s .A
- move.l a2,d2
- move.l d5,d3
- jsr _LVOWrite(a6)
- .A bra pr_lf
-
- *************************
- * FILENOTE *
- *************************
- filenotez bsr fixpam32 V2.0
- move.l a0,d1
- move.l a1,d2
- move.l a1,a2
- moveq #78,d0
- .A tst.b (a2)+
- beq.s fnok
- dbra d0,.A
- moveq #RETURN_ERROR,d0 ;more than 80 chars
- rts
- fnok jsr _LVOSetComment(a6)
- addq.l #1,d0
- bne DOSerr
- rts
-
- *************************
- * SEARCH * Searches a string in a file
- *************************
- searchz bsr rawh_off V2.0
- bsr fixpam32
- tst.b (a1)
- beq too_less_args
- move.l a1,d7
- bsr readfile get file
- move.l d1,d5 push size
- move.l d0,d6
- add.l d1,d6
- move.l d0,a2
- move.l d0,a3 a3:start of file
- .A move.l d7,a1 d7:search string
- move.l d6,a0 d6:end of file
- bsr searchSTR a2:current searchpos
- cmp.b #1,d0
- beq.s .B
- move.l a0,-(sp)
- move.l d7,a0
- moveq #-1,d4
- .D addq.l #1,d4
- tst.b (a0)+ length of searchstr.
- bne.s .D
- move.l a1,d2
- move.l a2,d3
- sub.l d2,d3
- beq.s .C
- move.l outhandle(a5),d1
- jsr _LVOWrite(a6) write part before searchstr.
- .C lea farb3(pc),a1
- bsr pr_string
- move.l a2,d2
- move.l d4,d3
- move.l outhandle(a5),d1
- jsr _LVOWrite(a6) write searchstr.
- lea farb1(pc),a1
- bsr pr_string
- move.l (sp)+,a0
- move.l a2,d2
- add.l d4,d2
- move.l a0,d3
- sub.l d2,d3
- beq.s .E
- move.l outhandle(a5),d1
- jsr _LVOWrite(a6) write part after searchstr.
- .E bsr pr_lf
- addq.l #1,a2
- bsr check_c
- beq.s .A
- .B move.l d5,d0
- move.l a3,a1
- bsr givemem free file
- endse moveq #RETURN_OK,d0
- rts
-
- * Searches for a string
- * ENTRY:a1 points to the string to search for (ends in NULL)
- * a2 points to start position, a0 to end of file, a3 to start
- * EXIT: a2 to found-position, a0 to NULL- or LF-end, a1 to LF-start
- * d0=1 not found, d0= found NULL-ended, d0=10 found LF-ended
- searchSTR
- movem.l d1-d7/a3-a5,-(sp)
- moveq #"Z",d5
- moveq #"A",d6
- moveq #" ",d7
- move.l a1,a4
- moveq #0,d4
- .B move.b (a4)+,d0
- beq.s .D
- addq.l #1,d4 count chars to search for
- cmp.b d5,d0
- bhi.s .A
- cmp.b d6,d0
- blo.s .A
- add.b d7,d0
- move.b d0,-1(a4) lowercase them
- .A bra.s .B
- .D move.b (a1),d0
- cmp.b ctrl_codes+15(a5),d0
- bne.s .C
- move.b #LF,(a1) begins with LineFeed
- .C move.l a3,a5
- move.l a0,d0 calc length of text
- sub.l a2,d0
- sub.l d4,d0
- move.l d0,d4
- move.l d4,d3
- swap d3
- moveq #0,d0
- moveq #0,d2
- move.b (a1),d2
- bra.s seabeg
- seastrt move.b (a2)+,d1
- cmp.b d5,d1
- bhi.s .E
- cmp.b d6,d1
- blo.s .E
- add.b d7,d1
- .E cmp.b d2,d1 compare first char
- bne.s seabeg
-
- lea 1(a1),a3
- move.l a2,a4
- .B move.b (a3)+,d0
- beq.s seafnd
- move.b (a4)+,d1
- cmp.b d5,d1
- bhi.s .F
- cmp.b d6,d1
- blo.s .F
- add.b d7,d1
- .F cmp.b d0,d1 compare other chars
- beq.s .B
-
- seabeg dbra d4,seastrt
- dbra d3,seastrt
- bra seaend
-
- seafnd subq.l #1,a2
- move.l a2,a1
- .D cmp.l a0,a4
- bhi seaend
- move.b (a4)+,d1 search end
- beq.s .G
- cmp.b #LF,d1
- bne.s .D
- cmp.b #LF,(a1)
- beq.s .H
- .F cmp.l a5,a1
- bls .G
- move.b -(a1),d0
- beq.s .H
- cmp.b #LF,d0 search beginning (if LF)
- bne.s .F
- .H addq.l #1,a1
- .G move.b d1,d2
- lea -1(a4),a0
- move.l d2,d0
- movem.l (sp)+,d1-d7/a3-a5
- rts
- seaend moveq #1,d0
- movem.l (sp)+,d1-d7/a3-a5
- rts
-
- *****************
- * FAULT *
- *****************
- faultz move.l parm2(a5),d0 V2.0
- beq too_less_args
- move.l d0,a1
- bsr convert_ASCII_to_num
- beq bad_number_error
- bsr pr_DOSerr
- .A moveq #RETURN_OK,d0
- rts
-
- *************************
- * SETCLOCK *
- *************************
- setclockz lea $dc0000,a4 ;clockbase V2.0
- move.b 1(a4),d4
- moveq #75,d1
- jsr _LVODelay(a6)
- cmp.b 1(a4),d4 ;secs changed ?
- beq.s noclk
- lea clk_tx(pc),a2
- move.l parm2(a5),d0
- beq.s .A
- move.l d0,a0
- move.l a2,a1
- bsr CheckOpt
- beq clkload
- lea 8(a2),a1
- bsr CheckOpt
- beq.s clksave
- .A move.l a2,a1
- bsr pr_stringlf
- uu moveq #RETURN_ERROR,d0
- rts
- noclk lea noclk_tx(pc),a1
- bsr pr_stringlf
- bra.s uu
-
- clksave lea date_mark(a5),a2
- move.l a2,a0
- bsr get_time
- move.l a2,a1
- lea -14(sp),sp
- lea (sp),a0
- bsr convert_time
- move.b 61(a4),d0 ;reset clock
- or.b #1,d0 ;(don't use bset or bclr !)
- move.b d0,61(a4)
- move.b #0,57(a4)
- move.b #5,61(a4)
- move.b #4,61(a4)
- move.b 53(a4),d0 ;hold clock
- or.b #1,d0
- move.b d0,53(a4)
- clks btst #1,53(a4)
- bne.s clks
- lea (sp),a0
- lea chaotab(pc),a1
- moveq #1,d6
- moveq #0,d1
- moveq #5,d0
- .A move.b (a1)+,d1
- moveq #0,d2
- move.w 0(a0,d1),d2
- divu #LF,d2
- swap d2
- move.b d2,0(a4,d6)
- swap d2
- move.b d2,4(a4,d6)
- addq.l #8,d6
- dbra d0,.A
- move.b 53(a4),d0
- and.b #$0e,d0
- move.b d0,53(a4) ;run clock
- lea 14(sp),sp
- moveq #RETURN_OK,d0
- rts
-
- chaotab dc.b 10,8,6,0,2,4
-
- getclk move.b 0(a4,d6),d1 ;Read realtimeclock
- move.b 4(a4,d6),d0 ;(adress in a4,offset in d6)
- addq.l #8,d6
- and.w #$f,d0
- and.w #$f,d1
- mulu #LF,d0
- add.w d1,d0
- ext.l d0 ;result
- rts
-
- ;load current time from realtime-clock
- clkload move.b 53(a4),d0
- or.b #1,d0
- move.b d0,53(a4)
- clkw btst #1,53(a4)
- bne.s clkw
- lea -6(sp),sp
- lea (sp),a3
- moveq #5,d2
- moveq #1,d6
- .A bsr getclk
- move.b d0,(a3)+
- dbra d2,.A
- lea (sp),a3
- bsr calcsec ;how many secs ?
- move.b 53(a4),d0
- and.b #$0e,d0
- move.b d0,53(a4)
- lea 6(sp),sp
- bsr tset ;give it to system
- moveq #RETURN_OK,d0
- rts
-
- calcsec moveq #0,d7 ;a3->points to 6 bytes of date/time
- moveq #1,d6 V2.0
- move.b (a3)+,d7 ;sec (collect secs in d7)
- moveq #0,d0
- move.b (a3)+,d0 ;min
- mulu #smin,d0
- add.l d0,d7
- moveq #0,d0
- move.b (a3)+,d0 ;std
- mulu #sst,d0
- add.l d0,d7
- moveq #0,d0
- move.b (a3)+,d0 ;tag
- subq.l #1,d0
- move.l d0,d5 ;collect days in d5
- moveq #0,d2
- move.b (a3)+,d2 ;monat
- lea montab(pc),a0
- moveq #0,d3
- move.b (a3)+,d3 ;jahr
- move.l d3,d0
- and.w #3,d0
- bne.s nosj
- move.b #29,1(a0) ;change montab
- nosj subq.l #2,d2
- bmi.s jan
- madd moveq #0,d0
- move.b 0(a0,d2),d0
- add.w d0,d5
- dbra d2,madd
- jan cmp.b #78,d3
- beq.s tset
- subq.l #1,d3
- moveq #0,d1
- jadd add.w #tjahr,d5
- move.l d3,d0
- and.w #3,d0
- bne.s nosj2
- addq.l #1,d5
- nosj2 cmp.b #78,d3
- dbeq d3,jadd
- move.b #28,1(a0)
- move.l #stag,d1
- move.l d5,d0
- bsr mult_32x32
- move.l d7,d6 ;d6=secs, d5=days
- add.l d0,d7 ;d7=all seconds since 1.1.78
- rts
-
- clrio lea io_Message(a5),a1 ;initialisiert IO-Request V2.0
- move.l a1,a0
- moveq #$2f,d0
- clst3 clr.b (a0)+
- dbra d0,clst3
- move.b #5,io_Message+8(a5)
- move.l thistask(a5),a0
- lea pr_MsgPort(a0),a0
- move.l a0,io_Message+14(a5)
- move.w #$30,io_Message+18(a5)
- rts ;a1:IO-Request a0:Msg-Port
-
- tset move.l 4.w,a6 ;set time with timer-device (secs in d7)
- bsr clrio V2.0
- move.w #40,io_Message+18(a5)
- lea timdev(pc),a0
- moveq #1,d0
- moveq #0,d1
- jsr _LVOOpenDev(a6)
- tst.l d0
- bne tmfehl
- lea io_Message(a5),a1
- move.w #11,io_Command(a5)
- clr.w io_Flags(a5)
- move.l d7,tv_secs(a5)
- clr.l tv_micro(a5)
- jsr _LVODoIO(a6)
- tst.l d0
- ; bne.s tmfehl ;better leave out
- lea io_Message(a5),a1
- clr.l io_Command(a5)
- jsr _LVOCloseDev(a6)
- tmfehl move.l dosbase(a5),a6
- rts
-
- smin equ 60
- sst equ 60*smin
- stag equ 24*sst
- tjahr equ 365
-
-
- *************************
- * SHOW *
- *************************
- soffs dc.w 378,336,350,364,322,392,532
-
- showz bsr rawh_off V2.0
- move.l parm2(a5),d0
- beq sdft
- move.l d0,a0
- move.b (a0),d1
- bset #5,d1
- cmp.b #"t",d1
- beq shtask
- cmp.b #"v",d1
- beq shvec
- lea styp(pc),a0
- moveq #6,d0 ;7 Lists
- .D cmp.b 0(a0,d0.w),d1
- dbeq d0,.D
- move.w d0,d7
- bmi sdft
- lea show_tx(pc),a1
- cmp.w #2,d7
- bhi.s .C
- lea show2_tx(pc),a1
- .C bsr pr_stringlf
- bsr do_forbid
- add.w d0,d0
- lea soffs(pc),a0
- move.w 0(a0,d0.w),d0
- move.l 4.w,a4
- move.l 0(a4,d0.w),a1
- ; move.l 8(a4,d0.w),a2
- lea tempbuf(a5),a3
- .A tst.l (a1)
- beq.s .B
- move.l a1,(a3)+
- move.l (a1),a1
- bra.s .A
- .B clr.l (a3)
- bsr do_permit
- lea tempbuf(a5),a3
- da tst.l (a3)
- beq sdf
- move.l (a3)+,a2
- move.l 10(a2),-(sp)
- lea shform(pc),a0
- cmp.w #2,d7
- bhi.s .E
- lea shform2(pc),a0
- move.w 22(a2),-(sp)
- move.w 20(a2),-(sp)
- .E move.b 9(a2),d0
- ext.w d0
- move.w d0,-(sp)
- move.l a2,-(sp)
- lea (sp),a1
- bsr new_print
- lea 10(sp),sp
- cmp.w #2,d7
- bhi.s da
- addq.l #4,sp
- bra.s da
- sdft lea shuse_tx(pc),a1
- bsr pr_stringlf
- moveq #RETURN_BAD,d0
- rts
- sdf moveq #RETURN_OK,d0
- rts
-
- shtask lea tempbuf(a5),a3 enough for 96 tasks
- move.l 4.w,a6
- jsr _LVOForbid(a6)
- lea 420(a6),a0
- move.l (a0),a1
- .A tst.l (a1)
- beq.s .B
- move.l a1,(a3)+
- move.l (a1),a1
- bra.s .A
- .B lea 406(a6),a0
- move.l (a0),a1
- .C tst.l (a1)
- beq.s .D
- move.l a1,(a3)+
- move.l (a1),a1
- bra.s .C
- .D move.l 276(a6),(a3)+
- clr.l (a3)
- jsr _LVOPermit(a6)
- move.l dosbase(a5),a6
- lea shta_tx(pc),a1
- bsr pr_stringlf
- lea tempbuf(a5),a3
- prsht move.l (a3)+,a2
- move.l 10(a2),-(sp)
- move.l #$00540061,d0 Task
- cmp.b #13,LN_TYPE(a2)
- bne.s .C
- move.l #$00500072,d0 Process
- .C move.l d0,-(sp)
- move.l tc_SigWait(a2),-(sp)
- moveq #0,d0
- move.b tc_State(a2),d0
- lea ttyp(pc),a0
- bra.s .A
- .B tst.b (a0)+
- bne.s .B
- .A dbra d0,.B
- move.l a0,-(sp)
- move.b LN_PRI(a2),d0
- ext.w d0
- move.w d0,-(sp)
- move.l a2,-(sp)
- lea (sp),a1
- lea shtaform(pc),a0
- bsr new_print Print it
- lea 22(sp),sp
-
- cmp.b #13,LN_TYPE(a2)
- bne.s snocli
- move.l pr_CLI(a2),d1
- beq.s snocli
- lsl.l #2,d1 ;cli-process
- move.l d1,a4
- lea null(pc),a1
- move.l a1,-(sp)
- move.l pr_COS(a2),d1
- cmp.l cli_StandardOutput(a4),d1
- beq.s .J
- lea bigger(pc),a0
- move.l a0,(sp)
- .J move.l a1,-(sp)
- move.l pr_CIS(a2),d1
- cmp.l cli_StandardInput(a4),d1
- beq.s .G
- lea smaller(pc),a0
- move.l a0,(sp)
- .G move.l a1,-(sp)
- move.l cli_CommandName(a4),d1
- beq.s .H
- lsl.l #2,d1
- move.l d1,a0
- lea temp2buf(a5),a1 BSTR !
- move.l a1,(sp)
- moveq #0,d1
- move.b (a0)+,d1
- bra.s .E
- .F move.b (a0)+,(a1)+
- .E dbra d1,.F
- clr.b (a1)
- .H move.l pr_TaskNum(a2),-(sp)
- lea null(pc),a1
- move.l a1,-(sp)
- tst.l cli_Background(a4) background ?
- beq.s .I
- lea backcli(pc),a1
- move.l a1,(sp)
- .I lea proform(pc),a0
- lea (sp),a1
- bsr new_print Print CLI-Add
- lea 20(sp),sp
- snocli bsr pr_lf
- tst.l (a3)
- bne prsht ;at least one task
- shtok moveq #RETURN_OK,D0
- rts
-
- shvec move.l 4.w,a0
- move.l eb_KickCheckSum(a0),-(sp)
- move.l eb_KickMemPtr(a0),-(sp)
- move.l eb_KickTagPtr(a0),-(sp)
- move.l eb_ColdCapture(a0),-(sp)
- move.l eb_CoolCapture(a0),-(sp)
- move.l eb_WarmCapture(a0),-(sp)
- lea (sp),a1
- lea vec_line(pc),a0
- bsr new_print
- moveq #RETURN_ERROR,d0
- moveq #5,d1
- move.l sp,a0
- .A tst.l (a0)+
- bne.s .B
- dbra d1,.A
- moveq #RETURN_OK,d0
- .B lea 6*4(sp),sp get rid of trash
- rts
-
-
- *************************
- * MemClock * V2.0
- *************************
-
- ckstackSIZE equ 2000
- cktask equ 0 ;Task-Struct
- ckport equ cktask+92 ;MsgPort
- ckstack equ ckport+34 ;Stack
- ckustack equ ckstack+ckstackSIZE
- ckdos equ ckustack ;DOSBase
- ckint equ ckdos+4 ;Intuitionbase
- ckitxt equ ckint+4 ;IntuiTextStruct
- ckdate equ ckitxt+20 ;DateStamp
- ckrawdo equ ckdate+12 ;DataStream
- ckcook equ ckrawdo+6+8 ;Formatted String
- ckrast equ ckcook+40 ;Rastports of all Windows
- cknum equ ckrast+20*4 ;Number of Windows
- ckalarm equ cknum+4 ;Alarm-Time
- ckpad equ ckalarm+8
- cksize equ ckpad+2
-
- mlnode equ 0 ;Memory-List
- mlnum equ mlnode+14
- mladdr equ mlnum+2
- mllen equ mladdr+4
- mlsize equ mllen+4
-
- memclkz move.l parm2(a5),d0
- beq too_less_args
- move.l d0,a0
- move.b (a0),d0
- bset #5,d0
- cmp.b #"a",d0 ;alarm
- beq clkalm
- bsr CheckOnOff
- beq clkoff
-
- clkon move.b #1,memclk_flag(a5) switch it on
- move.l 4.w,a6
- lea clktask(pc),a1
- jsr _LVOFindTask(a6)
- move.l d0,a4
- tst.l d0
- beq.s .A ;not already running
- bsr winclk
- .B moveq #RETURN_OK,d0
- rts
- .A move.l #cksize,d0
- move.l #1+1<<16,d1
- jsr _LVOAllocMem(a6)
- tst.l d0
- beq.s .B
- move.l d0,a4
- move.w #$0104,cktask+8(a4) ;type/pri
- lea clktask(pc),a0
- move.l a0,cktask+10(a4) ;name
- lea ckstack(a4),a0
- lea ckustack(a4),a1
- move.l a1,cktask+54(a4) ;SPreg
- move.l a0,cktask+58(a4) ;lowerstack
- move.l a1,cktask+62(a4) ;upperstack
- move.l a4,ckport+16(a4) ;sigtask
- lea ckport+20+4(a4),a0
- move.l a0,ckport+20(a4)
- lea ckport+20(a4),a0
- move.l a0,ckport+20+8(a4)
- move.l #mlsize,d0
- move.l #1+1<<16,d1
- jsr _LVOAllocMem(a6)
- tst.l d0
- beq.s .B
- move.l d0,a2
- moveq #1,d0
- move.w d0,mlnum(a2)
- move.l a4,mladdr(a2)
- move.l #cksize,mllen(a2)
- lea mlnode(a2),a0
- lea cktask+78(a4),a1
- move.l a0,-4(a1)
- move.l a0,4(a1)
- move.l a1,(a0)
- move.l a1,4(a0)
- move.l dosbase(a5),ckdos(a4)
- move.l intuibase(a5),ckint(a4)
- bsr winclk
- move.l 4.w,a6
- move.l a4,a1
- lea clkstart(pc),a2
- moveq #0,d0
- move.l d0,a3
- jsr _LVOAddTask(a6)
- move.l dosbase(a5),a6
- moveq #RETURN_OK,d0
- rts
-
- winclk bsr findrast ;check if rastport already exists,
- tst.w d1 ;else move rastport in table
- bpl.s .C
- moveq #19,d1
- .B tst.l (a1)+
- dbeq d1,.B
- bne.s .C
- move.l d0,-4(a1)
- .C rts
-
- findrast
- move.l dosbase(a5),a6
- bsr GetWindowPtr window-ptr to a0
- move.l $32(a0),d0 rastport
- lea ckrast(a4),a0
- move.l a0,a1
- moveq #19,d1
- .A cmp.l (a0)+,d0
- dbeq d1,.A
- rts
-
- clkoff clr.b memclk_flag(a5) switch it off
- clkof2 move.l a4,-(sp)
- move.l 4.w,a6
- lea clktask(pc),a1
- jsr _LVOFindTask(a6)
- move.l d0,a4
- tst.l d0
- beq.s .A
- bsr findrast
- tst.w d1
- bmi.s .A
- moveq #0,d0
- move.l d0,-4(a0)
- .A move.l (sp)+,a4
- move.l dosbase(a5),a6
- moveq #RETURN_OK,d0
- rts
-
- clkalm move.l 4.w,a6 ;set alarm-time
- lea clktask(pc),a1
- jsr _LVOFindTask(a6)
- move.l dosbase(a5),a6
- move.l d0,a4
- tst.l d0
- beq.s .A
- tst.l parm3(a5)
- bne.s .B
- lea ckalarm(a4),a1
- bsr pr_stringlf show alarm
- bra.s .A
- .B move.l parm3(a5),a0
- lea ckalarm(a4),a1
- moveq #7,d0
- .C move.b (a0)+,(a1)+ set alarm
- dbra d0,.C
- .A moveq #RETURN_OK,d0
- rts
-
- clkstart sub.l a1,a1 ;Here starts the MemClockTaskCode !
- move.l 4.w,a6
- jsr _LVOFindTask(a6)
- move.l d0,a5
- move.l #$00010100,ckitxt(a5)
- .A move.l d5,cknum(a5) ;teststuff
- lea ckdate(a5),a0
- move.l a0,d1
- move.l ckdos(a5),a6
- jsr _LVODateStamp(a6)
- move.l ckdate+4(a5),d0 ;mins
- divu #60,d0
- move.w d0,ckrawdo+8(a5)
- swap d0
- move.w d0,ckrawdo+10(a5)
- move.l ckdate+8(a5),d0 ;secs
- divu #50,d0
- move.w d0,ckrawdo+12(a5)
- moveq #2,d1
- move.l 4.w,a6
- jsr _LVOAvailMem(a6) ;memory
- move.l d0,ckrawdo+4(a5)
- moveq #1,d1
- jsr _LVOAvailMem(a6)
- move.l d0,ckrawdo+0(a5)
- lea clkform(pc),a0
- lea ckrawdo(a5),a1
- lea KPutChar(pc),a2
- lea ckcook(a5),a3
- jsr _LVORawDoFmt(a6) ;rawdofmt
- lea ckcook+26(a5),a0
- lea ckalarm(a5),a1
- moveq #7,d0
- .D move.b (a0)+,d1
- cmp.b (a1)+,d1
- bne.s .E
- dbra d0,.D
- move.l ckint(a5),a6
- suba.l a0,a0
- jsr _LVODisplayBeep(a6)
- .E lea ckcook(a5),a0
- move.l a0,ckitxt+12(a5)
- lea ckrast(a5),a2
- moveq #0,d5
- moveq #19,d4
- .B move.l (a2)+,a0 ;check all 20 Rastports
- move.l a0,d0
- beq.s .C
- addq.l #1,d5
- lea ckitxt(a5),a1
- moveq #0,d0
- moveq #1,d1
- move.l ckint(a5),a6
- jsr _LVOPrintIText(a6)
- .C dbra d4,.B
- moveq #LF,d1
- move.l ckdos(a5),a6
- jsr _LVODelay(a6) ;wait 1/5 sec
- tst.l d5
- bne .A
- move.l 4.w,a6
- rts
-
-
- *************************
- * CTRL * V2.0
- ************************* set or show ctrl-codes
- ctrlz move.l parm2(a5),d0
- beq.s .A
- move.l d0,a0
- bsr return_dash_option
- cmp.b #'C',d0 option -COMPLET ?
- beq.s ctrlcpl
- cmp.b #'R',d0 option -RECOLOR ?
- beq.s recolor
- lea ctrl_codes(a5),a1
- moveq #ctrl_inite-ctrl_init-1,d1
- .B move.b (a0)+,d0
- beq.s .A
- and.b #$3f,d0 set ctrl codes
- move.b d0,(a1)+
- dbra d1,.B
- .A lea ctrl_tx(pc),a1 show ctrl codes
- bsr pr_string
- lea ctrl_codes(a5),a0
- lea tempbuf(a5),a1
- move.l a1,a2
- moveq #ctrl_inite-ctrl_init-1,d1
- .C move.b (a0)+,d0
- add.b #$40,d0
- move.b d0,(a2)+
- dbra d1,.C
- clr.b (a2)
- bsr pr_stringlf
- ctrlend moveq #RETURN_OK,d0
- rts
-
- ctrlcpl lea ignoreit(a5),a1 set or show exeptions of
- move.l parm3(a5),d0 filenamecompletition
- beq.s .A
- move.l d0,a0
- moveq #60-1,d0
- .B move.b (a0)+,(a1)+
- beq.s ctrlend
- dbra d0,.B
- bra.s ctrlend
- .A bsr pr_stringlf
- bra.s ctrlend
-
- recolor move.l parm3(a5),d0
- beq too_less_args
- move.l d0,a3
- lea start(pc),a0
- lea recol1(pc),a1
- lea recol2(pc),a2
- moveq #0,d2
- moveq #(recol2-recol1)/2-1,d0
- .A move.w (a1)+,d1
- move.b (a2)+,d2
- move.b 0(a3,d2.w),d3
- move.b d3,0(a0,d1.w)
- dbra d0,.A
- bra clsz
-
- *************************
- * Locate * V2.0
- ************************* Show the Path and Filename of a Lock-Struct
- locatez ;or lock object or delete lock
- bsr fixpam32
- move.l a0,a3
- move.l a1,a2
- move.l a0,a1 ;parm2
- moveq #0,d7
- bsr return_dash_option
- cmp.b #"C",d0
- bne.s .F
- moveq #-1,d7 delete lock after showing
- move.l a2,a1
- .F bsr convert_ASCII_to_num
- bne.s .D
- moveq #ACCESS_READ,d2
- move.l a2,a1 ;parm3 create lock
- bsr convert_ASCII_to_num
- beq.s .E
- move.l d0,d2
- .E move.l a3,d1 ;parm2
- jsr _LVOLock(a6)
- tst.l d0
- beq .A
- .D move.l d0,a2 write out name
- move.l d0,d6
- add.l a2,a2
- add.l a2,a2
- moveq #ACCESS_WRITE,d1
- cmp.l fl_Access(a2),d1 what kind of lock
- bne.s .B
- lea lockwrite(pc),a1
- bra.s .C
- .B subq.l #1,d1
- cmp.l fl_Access(a2),d1
- bne.s .A
- lea lockread(pc),a1
- .C lea -16(sp),sp
- move.l a1,(sp)
- move.l fl_Link(a2),12(sp)
- move.l d6,8(sp)
- move.l d0,d1
- jsr _LVODupLock(a6)
- lea tempbuf(a5),a0
- move.l a0,4(sp)
- bsr eval_full_path evaluate the full name
- jsr _LVOUnLock(a6)
- move.l sp,a1
- lea locktext(pc),a0
- bsr new_print
- lea 16(sp),sp
- tst.l d7
- beq.s .G
- move.l d6,d1
- jsr _LVOUnLock(a6)
- lea deleteOK(pc),a1
- bsr pr_string
- .G moveq #RETURN_OK,d0
- rts
- .A lea lockntx(pc),a1
- bsr pr_stringlf
- lkerr moveq #RETURN_ERROR,d0
- rts
-
- *************************
- * NewCLI * V2.0
- *************************
- newcliz lea ZShellName(pc),a0
- move.l a0,d1 process-name
- moveq #0,d2 priority
- lea start-4(pc),a0
- move.l a0,d3
- lsr.l #2,d3 seglist
- move.l #4000,d4 stacksize
- jsr _LVOCreateProc(a6)
- tst.l d0
- beq.s lkerr
- move.l d0,a4 a4:new process
- moveq #$24,d0
- move.l #MEMF_CLEAR+1,d1 memory for Message
- bsr iwantmem
- beq.s lkerr
- move.l d0,a1 a1,a3:message
- move.l a1,a3
- move.b #5,LN_TYPE(a1)
- move.l thistask(a5),a0
- lea pr_MsgPort(a0),a2 a2:msgport of this task
- move.l a2,mn_ReplyPort(a1)
- move.w #$24,mn_Length(a1)
- move.l pr_CurrentDir(a0),sm_ToolWindow(a1)
- move.l a5,sm_NumArgs(a1)
- move.l a4,a0
- move.l 4.w,a6
- jsr _LVOPutMsg(a6)
- .A move.l a2,a0
- jsr _LVOWaitPort(a6)
- move.l a2,a0
- jsr _LVOGetMsg(a6)
- cmp.l a3,d0
- bne .A
- ; move.l dosbase(a5),a6
- move.l d0,a1
- moveq #$24,d0
- bsr givemem
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * RUN * V2.2
- *************************
- runz clr.l parm3(a5)
- bsr ConvertSemi
- move.l parm2(a5),a0
- bsr return_dash_option
- lea CLIbuf(a5),a1
- cmp.b #'C',d0
- bne.s .C
- lea runnil(pc),a0 redir in/out to nil
- move.l a0,parm3(a5)
- clr.l parm4(a5)
- addq.l #3,a1
- .C lea tempbuf(a5),a0
- move.l a0,parm2(a5)
- move.w #'-c',(a0)+
- .A move.b (a1)+,(a0)+ copy CLIbuf
- bne.s .A
- subq.l #1,a0
- lea runit(pc),a1
- .B move.b (a1)+,(a0)+ copy appendix
- bne.s .B
- bra newcliz
-
- *************************
- * TaskPri * V2.0
- *************************
- taskpriz bsr fixpam32
- move.l a1,a2
- move.l a0,a1
- tst.b (a1)
- beq too_less_args
- bsr convert_ASCII_to_num
- beq bad_number_error
- move.l d0,d7
- bsr findtsk
- beq.s tskfail
- move.l a0,a1
- move.b d7,d0
- move.l 4.w,a6
- jsr _LVOSetTaskPri(a6)
- tskok move.l dosbase(a5),a6
- lea OK_text(pc),a1
- bsr pr_string
- moveq #RETURN_OK,d0
- rts
- tskfail lea notasktx(pc),a1
- bsr pr_stringlf
- tkfail moveq #RETURN_ERROR,d0
- rts
-
- * Find Task given in a2 (ptr,string,cli-number,null)
- * RETURN: d0,a0 address (0 if not found)
- findtsk move.l a2,a1
- moveq #0,d0
- tst.b (a1)
- beq.s .E
- bsr convert_ASCII_to_num
- beq.s .C
- .E cmp.l #20,d0
- bhi.s .A is address
- move.l d0,a1
- tst.l d0 0 means own task
- beq.s .D
- lsl.l #2,d0 is a cli-number
- move.l dl_Root(a6),a0
- move.l (a0),a0
- add.l a0,a0
- add.l a0,a0
- add.l d0,a0
- move.l (a0),d0
- beq.s .B
- sub.l #pr_MsgPort,d0
- bra.s .A
- .C move.l a2,a1
- .D move.l 4.w,a6
- jsr _LVOFindTask(a6) search name
- move.l dosbase(a5),a6
- .A tst.l d0
- beq.s .B
- move.l d0,a0
- cmp.b #01,LN_TYPE(a0) is it a TASK-struct ?
- beq.s .B
- cmp.b #13,LN_TYPE(a0) is it a PROCESS-struct ?
- beq.s .B
- moveq #0,d0
- .B tst.l d0
- rts
-
- *************************
- * Break * V2.0
- *************************
- breakz bsr fixpam32
- move.l a0,a2
- move.l a1,a3
- tst.b (a2)
- beq too_less_args
- bsr findtsk
- beq.s tskfail
- move.l a3,a1
- move.l a0,a2
- tst.b (a1)
- beq.s .B
- bsr convert_ASCII_to_num
- bne.s .C
- move.b (a3),d1
- bclr #5,d1
- cmp.b #"C",d1
- blo tkfail
- cmp.b #"F",d1
- bhi tkfail
- sub.b #55,d1
- moveq #0,d0
- bset d1,d0
- bra.s .C
- .B move.l tc_SigWait(a2),d0
- .C move.l a2,a1
- move.l 4.w,a6
- jsr _LVOSignal(a6) set signals given in mask
- bra tskok
-
- *************************
- * PutMsg * V2.0
- *************************
- putmsgz move.l parm2(a5),d7
- beq printa5
- move.l d7,a1
- bsr convert_ASCII_to_num
- bne.s .D
- move.l d7,a1
- move.l 4.w,a6
- jsr _LVOFindPort(a6) search name
- move.l dosbase(a5),a6
- tst.l d0
- beq.s .B
- move.l d0,a0
- bra.s .E
- .D move.l d0,a0
- cmp.l #20,d0
- bls.s .B
- cmp.b #04,LN_TYPE(a0) is it a MSGPORT-struct ?
- beq.s .E
- .B move.l d7,a2
- bsr findtsk search task
- bne.s .C
- .A lea noporttx(pc),a1
- bsr pr_stringlf
- moveq #RETURN_ERROR,d0
- rts
- .C cmp.b #13,LN_TYPE(a0) is it a PROCESS-struct ?
- bne.s .A
- lea pr_MsgPort(a0),a0
- .E bsr clearArgs
- move.l thistask(a5),a2
- lea pr_MsgPort(a2),a2
- move.l a2,sp_reply(a5)
- move.b #5,LN_TYPE+sp_node(a5)
- lea parm3(a5),a2
- lea sp_link(a5),a3
- moveq #mn_Size,d2
- .G move.l (a2)+,d3
- beq.s .F
- move.l d3,a1
- bsr convert_ASCII_to_num
- bne.s .H
- move.l d3,d0
- .H move.l d0,(a3)+
- addq.w #4,d2
- bra.s .G
- .F move.w d2,sp_length(a5)
- move.l sp_link(a5),a1
- move.b (a1),d0
- cmp.b ctrl_codes+15(a5),d0
- bne.s .I
- lea sp_link(a5),a1 for DOSpackets
- move.l a1,LN_NAME+sp_node(a5)
- lea sp_node(a5),a1
- move.l a1,sp_link(a5)
- move.l sp_reply(a5),sp_port(a5)
- .I lea msendtx(pc),a1
- bsr pr_stringlf
- lea sp_node(a5),a1 message
- move.l 4.w,a6
- jsr _LVOPutMsg(a6)
- move.l dosbase(a5),a6
- clr.l parm2(a5)
- bra.s getmsg1
-
- *************************
- * GetMsg * V2.0
- *************************
- getmsgz moveq #0,d7
- moveq #0,d6
- move.l parm2(a5),d2
- beq.s getmsg1
- move.l d2,a1
- move.l 4.w,a6
- jsr _LVOFindPort(a6) does it already exist ?
- tst.l d0
- bne.s getmsg1
- move.l thistask(a5),a1
- lea pr_MsgPort(a1),a1
- move.l d2,LN_NAME(a1)
- jsr _LVOAddPort(a6)
- moveq #1,d6
- getmsg1 move.l thistask(a5),a2
- lea pr_MsgPort(a2),a2
- move.l 4.w,a6
- move.l a2,a0
- jsr _LVOGetMsg(a6)
- tst.l d0
- bne.s .A
- moveq #0,d2
- move.b MP_SIGBIT(a2),d1
- bset d1,d2
- bset #SIGBREAKB_CTRL_C,d2
- move.l d2,d1
- ; moveq #0,d0
- jsr _LVOSetSignal(a6) clear signals
- move.l d2,d0
- jsr _LVOWait(a6) wait for msgport or ctrl-c
- move.l a2,a0
- jsr _LVOGetMsg(a6)
- .A move.l dosbase(a5),a6
- tst.l d0
- beq msgfail
- move.l d0,a2
- move.w mn_Length(a2),d2
- move.w d2,-(sp)
- move.l a2,-(sp)
- lea msgtx(pc),a0
- move.l sp,a1
- bsr new_print
- addq.l #6,sp
- sub.w #mn_Size,d2
- lsr.w #2,d2
- lea mn_Size(a2),a3
- bra.s .D
- .C move.l (a3)+,d0
- cmp.l #$dfe000,d0
- bhs.s .E
- cmp.l #$a00000,d0
- blo.s .F
- cmp.l #$c00000,d0
- blo.s .E
- .F move.l d0,a0
- moveq #79,d1
- .H move.b (a0)+,d3
- beq.s .G
- cmp.b #" ",d3
- blo.s .E
- cmp.b #"~",d3
- bhi.s .E
- dbra d1,.H
- bra.s .E
- .G cmp.w #76,d1
- bhs.s .E
- bsr printADR
- bsr pr_space
- move.l d0,a1
- bsr pr_stringlf
- bra.s .D
- .E bsr printADR
- bsr pr_lf
- .D dbra d2,.C
- tst.l d7
- bne.s .B
- tst.l d6
- beq.s .I
- move.l thistask(a5),a1
- lea pr_MsgPort(a1),a1
- move.l 4.w,a6
- jsr _LVORemPort(a6)
- move.l dosbase(a5),a6
- .I lea replytx(pc),a1
- bsr pr_string
- bsr rask
- move.l d0,d2
- beq.s .B
- move.l 4.w,a6
- move.l a2,a1
- jsr _LVOReplyMsg(a6)
- move.l dosbase(a5),a6
- cmp.b #RETURN_ERROR,d2
- beq getmsg1
- .B moveq #RETURN_OK,d0
- rts
- printa5 move.l a5,-(sp)
- move.l sp,a1
- lea pra5tx(pc),a0
- bsr new_print
- addq.l #4,sp
- bsr DisplayBeep
- msgfail moveq #RETURN_ERROR,d0
- rts
-
- *************************
- * Border * V2.0
- *************************
- wd_BorderLeft equ 54
- wd_Flags equ 24
-
- borderz move.l parm2(a5),a0
- bsr CheckOnOff
- move.l d0,-(sp)
- bsr GetWindowPtr
- move.l a0,a4 this window
- move.l intuibase(a5),a6
- moveq #0,d0
- jsr _LVOLockIBase(a6)
- move.l d0,d7
- move.l (sp)+,d0
- beq bordoff
-
- bordon tst.l bordersize(a5)
- beq.s borne
- bclr #11,wd_Flags+2(a4) unset noborder
- move.l bordersize(a5),wd_BorderLeft(a4)
- bra.s borjo
-
- bordoff tst.l wd_BorderLeft(a4)
- beq.s borjo
- bset #11,wd_Flags+2(a4) set noborder-window
- move.l wd_BorderLeft(a4),bordersize(a5)
- clr.l wd_BorderLeft(a4)
- borjo moveq #$00,d0 null resize
- moveq #$00,d1
- move.l a4,a0
- jsr _LVOSizeWindow(a6)
- move.l a4,a0
- jsr _LVORefreshWindowFrame(a6) redraw
- borne move.l d7,a0
- jsr _LVOUnlockIBase(a6)
- move.l parm3(a5),d0
- beq.s nosiz
- move.l d0,a1
- bsr convert_ASCII_to_num
- tst.l d1
- beq.s nosiz
- ;resize window to fill screen
- move.l $2e(a4),a1 points to screen
- move.l d0,d4 width of menubar
- bpl.s .A
- moveq #0,d4
- move.b 30(a1),d4
- add.b 31(a1),d4
- .A moveq #-1,d2
- move.l 12(a1),d3
- sub.w 10(a4),d3
- sub.w d4,d3
- move.w d3,d1
- bpl.s bklein
- moveq #0,d2
- moveq #0,d0
- move.l a4,a0
- jsr _LVOSizeWindow(a6)
- bklein moveq #0,d0
- sub.w 4(a4),d0
- move.l d4,d1
- sub.w 6(a4),d1
- move.l a4,a0
- jsr _LVOMoveWindow(a6)
- moveq #0,d1
- tst.b d2
- beq.s bgross
- move.w d3,d1
- bgross swap d3
- sub.w 8(a4),d3
- move.w d3,d0
- move.l a4,a0
- jsr _LVOSizeWindow(a6)
- jsr _LVORethinkDisplay(a6)
-
- nosiz move.l dosbase(a5),a6
- moveq #10,d1 wait more than 1/10 sec
- jsr _LVODelay(a6)
- moveq #RETURN_OK,d0
- rts
-
- *************************
- * Review * V2.1
- *************************
- reviewz move.l parm2(a5),d0
- beq.s ShowReview
- move.l d0,a1
- move.l d0,a2
- bsr convert_ASCII_to_num
- bne.s MakeReview
- or.b #$20,(a2)
- cmp.b #"c",(a2)
- beq.s ClearReview
- cmp.b #"s",(a2)
- bne.s ShowReview
- move.l parm3(a5),d0 Save review-buffer
- beq too_less_args
- tst ReviewSize(a5)
- beq.s ShowReview
- move.l d0,a3
- bra viewbuffer
-
- ShowReview
- move.l ReviewSize(a5),d0 Show review-info
- bsr print10
- lea view1_tx(pc),a1
- bsr pr_string
- moveq #RETURN_OK,d0
- rts
-
- ClearReview
- move.l ReviewMem(a5),a0
- move.l ReviewSize(a5),d0
- move.l d0,d1
- swap d1
- bra.s .D
- .E move.b #" ",(a0)+ Fill with spaces
- .D dbra d0,.E
- dbra d1,.E
- move.b #LF,-1(a0) Last char is LF
- clr.l ReviewPtr(a5)
- moveq #RETURN_OK,d0
- rts
-
- MakeReview
- tst.l d0 Add review-buffer
- beq reviewend
- tst.l ReviewSize(a5)
- beq.s .F
- move.l d0,-(sp)
- bsr reviewend
- move.l (sp)+,d0
- .F move.l d0,d2
- moveq #1,d1
- bsr iwantmem
- beq ShowReview
- move.l d0,ReviewMem(a5)
- move.l d2,ReviewSize(a5)
- bsr ClearReview
- clr.b noreview_flag(a5)
- lea RHa3(pc),a3 Look for a5-Table
- tst.l (a3)
- bne.s entryA5
- moveq #80,d0
- move.l #1+1<<16,d1 "memf_public" & clear it
- bsr iwantmem
- beq reviewend
- move.l d0,(a3)
- APatch moveq #_LVOWrite,d2 Add review-patch to DOS Write
- move.w #$4ef9,d3
- move.l a6,a2
- add.l d2,a2
- moveq #0,d1
- cmp.w (a2),d3
- bne.s .B
- move.l 2(a2),a0
- lea RCode(pc),a1
- cmp.l a1,a0
- beq.s entryA5
- moveq #-1,d1
- bra.s .C
- .B cmp.w #$6000,2(a2)
- bne.s reviewend
- .C movem.l d0-d1/a0-a1,-(sp)
- bsr do_forbid
- movem.l (sp)+,d0-d1/a0-a1
- lea RHa1(pc),a1
- move.w (a2),(a1)
- move.l 2(a2),2(a1)
- tst.w d1
- bne.s .D
- lea 4(a2),a0
- move.w (a0),d0
- ext.l d0
- add.l d0,a0
- move.l a0,4(a1)
- move.w d3,2(a1)
- .D lea RCode(pc),a0
- move.w d3,(a2)
- move.l a0,2(a2)
- bsr do_permit
- entryA5 move.l (a3),a3 Add a5-table entry
- moveq #20-1,d0
- .F tst.l (a3)+
- beq.s .G
- dbra d0,.F
- bra reviewend
- .G move.l a5,-4(a3)
- bra reviewOK
-
- reviewend ;Remove review-buffer
- move.l RHa3(pc),d0 Remove a5-table entry
- beq.s remmem2
- move.l d0,a0
- move.l a0,a1
- move.l a0,a2
- moveq #20-1,d0
- .A cmp.l (a0)+,a5
- beq.s .B
- dbra d0,.A
- bra.s .D
- .B clr.l -4(a0)
- .D moveq #20-1,d0 look for other entries
- .C tst.l (a2)+
- bne.s remmem2
- dbra d0,.C
- bsr do_forbid
- lea RHa3(pc),a0
- clr.l (a0)
- moveq #80,d0 last entry
- bsr givemem
- moveq #_LVOWrite,d0 Remove DOS Write Patch
- move.l a6,a3
- add.l d0,a3
- move.l 2(a3),a0
- lea RCode(pc),a1
- cmp.l a0,a1
- bne.s remmem
- lea RHa1(pc),a1
- move.w (a1),(a3)
- move.l 2(a1),2(a3)
- cmp.w #$4ef9,(a1)
- beq.s remmem
- move.w #$6000,2(a3)
- lea 4(a3),a2
- move.l 4(a1),d0
- sub.l a2,d0
- move.w d0,(a2)
- remmem bsr do_permit
- remmem2 move.l ReviewSize(a5),d0 Remove buffer-memory
- beq.s reviewOK
- move.l ReviewMem(a5),a1
- bsr givemem
- clr.l ReviewSize(a5)
- reviewOK
- moveq #RETURN_OK,d0
- rts
-
- viewbuffer ;Show the review-buffer using more
- move.l ReviewMem(a5),a2
- move.l ReviewPtr(a5),d3
- move.l ReviewSize(a5),d2
- bne.s viewhist
- rts
- viewhist ;;Show a circular buffer using more
- move.l d2,d4
- move.l MPipePtr(a5),d1
- beq.s .A
- move.l d3,d0 for redirecting to more
- move.l d1,d3
- sub.l d0,d1
- bpl.s .C
- add.l d2,d1
- bra.s .C
- .A
- .I move.b 0(a2,d3.l),d0
- addq.l #1,d3
- cmp.l d3,d2
- bhi.s .B
- clr.l d3
- .B addq.l #1,d1
- cmp.b #LF,d0
- beq.s .C
- cmp.b #12,d0
- bne.s .I
- .C sub.l d1,d2
- move.l d2,d0
- beq.s reviewOK
- moveq #1,d1
- bsr iwantmem
- beq.s reviewOK
- move.l d0,a0
- move.l a0,a1
- move.l d4,d1
- move.l d2,d4
- bra.s .E
- .D move.b 0(a2,d3.l),d0
- cmp.b #12,d0
- bne.s .G
- move.b #LF,d0
- .G cmp.b #"c",d0
- bne.s .H
- cmp.b #27,-1(a0)
- bne.s .H
- move.b #" ",-1(a0)
- move.b #LF,d0
- .H move.b d0,(a0)+
- addq.l #1,d3
- cmp.l d3,d1
- bhi.s .E
- clr.l d3
- .E dbra d2,.D
- move.l a3,d0
- bne.s viewwrite
- move.l a1,d0
- move.l d4,d1
- moveq #-1,d2
- tst.l MPipePtr(a5)
- beq.s .F
- moveq #0,d2
- .F moveq #0,d4
- bra ViewMore
- viewwrite ;write buffer to file
- move.l a1,a2
- move.l a3,d1
- move.l #MODE_NEWFILE,d2
- jsr _LVOOpen(a6)
- tst.l d0
- beq.s .A
- move.l d0,a3
- move.l a3,d1
- move.l a2,d2
- move.l d4,d3
- move.l d3,-(sp)
- jsr _LVOWrite(a6)
- move.l (sp)+,d3
- sub.l d0,d3
- move.l a3,d1
- jsr _LVOClose(a6)
- moveq #1,d0
- tst.l d3
- beq.s .A
- moveq #0,d0
- .A move.l d0,d2
- move.l d4,d0
- move.l a2,a1
- bsr givemem
- tst.l d2
- beq DOSerr
- bra reviewOK
-
-
-
- ***** ReviewHandler ********
- RHa1 dc.w $4ef9 JMP
- RHa2 dcb.w 3 Return-Code
- RHa3 dcb.l 1 Memory-Base-Table
-
- RCode movem.l d0-d3/a5-a6,-(sp) ;Is called by the DOS Write fkt.
- move.l RHa3(pc),d0
- beq.s .C
- move.l d0,a0
- moveq #20-1,d0
- .B move.l (a0)+,a5
- cmp.l outhandle(a5),d1
- beq.s .A
- dbra d0,.B
- bra.s .C
- .A tst.b noreview_flag(a5)
- bne.s .C
- bsr toreview
- .C movem.l (sp)+,d0-d3/a5-a6
- bra.s RHa1
-
- toreview ;Writes data to review-buffer,Entry: d2=Adress, d3=Length
- move.l d2,a0
- move.l ReviewMem(a5),a1
- move.l ReviewPtr(a5),d1
- move.l ReviewSize(a5),d2
- beq.s .C
- bra.s .B
- .A move.b (a0)+,d0
- move.b d0,0(a1,d1.l)
- addq.l #1,d1
- cmp.l d1,d2
- bhi.s .B
- clr.l d1
- .B dbra d3,.A
- move.l d1,ReviewPtr(a5)
- .C rts
-
-
- **********************************************************************
- ; check if string in a0 is same as in a1 (limited by null,comma,space)
- ; return: d0=0 for match, 1 otherwise
- CheckOpt
- move.l a0,-(sp)
- .A move.b (a1)+,d1 compare things
- beq.s .B
- cmp.b #" ",d1
- beq.s .B
- cmp.b #",",d1
- beq.s .B
- move.b (a0)+,d0
- beq.s .H
- cmp.b ctrl_codes+15(a5),d0 check for .
- bne.s .F
- tst.b (a0)
- beq.s .G
- .F bsr compD1D0nocase
- beq.s .A
- .H moveq #1,d0 failed (not matched)
- bra.s .E
- .G moveq #0,d0 success (abbreviated)
- .E move.b (a1)+,d1 search for end
- beq.s .D
- cmp.b #" ",d1
- beq.s .D
- cmp.b #",",d1
- bne.s .E
- bra.s .D
- .B moveq #1,d0 success or a0 is too long ?
- tst.b (a0)
- bne.s .D
- moveq #0,d0 length is same -> success
- .D move.l (sp)+,a0
- tst.l d0
- rts
-
- *************************
- ; check a0 for ON (d0=1) or OFF (d0=0) option, otherwise error-exit
- CheckOnOff
- move.l a2,-(sp)
- lea onoffuse(pc),a2
- move.l a0,d0
- beq.s .B
- lea 6(a2),a1
- bsr CheckOpt
- beq.s .A
- move.l a2,a1
- bsr CheckOpt
- bne.s .B
- moveq #1,d0
- .A move.l (sp)+,a2
- rts
- .B move.l a2,a1
- *************************
- ; print error in a1 and exit
- ErrorExit
- bsr pr_stringlf
- bra galactic
-
- *************************
- ; check for Kickstart 2.0 or better, exit on error
- CheckKS lea oldkick_tx(pc),a1
- cmp.w #36,kickver(a5)
- blo.s ErrorExit
- rts
-
- **********************************************************************
- ; check if option in a0 is in parm-list and deletes it from parm-list
- ; return: d0=0 for match, 1 otherwise
- LookForOpt
- movem.l a2-a3,-(sp)
- move.l a0,a2
- lea parm2(a5),a3
- .A move.l (a3)+,d0 search all parms
- beq.s .B
- move.l a2,a1
- move.l d0,a0
- bsr CheckOpt look for option
- bne.s .A
- lea -4(a3),a2 found it !
- .D move.l (a3)+,(a2)+ delete found parm
- bne.s .D
- moveq #0,d0
- bra.s .C
- .B moveq #1,d0 not found !
- .C movem.l (sp)+,a2-a3
- rts
-
- *************************
- * MakeLink * V2.3
- *************************
- makelinkz
- bsr CheckKS
- moveq #0,d7
- moveq #0,d3
- lea linkuse(pc),a2
- move.l parm4(a5),d0
- beq.s .C
- move.l d0,a0
- move.l a2,a1
- bsr CheckOpt
- beq.s .B
- moveq #-1,d3
- lea 8(a2),a1
- bsr CheckOpt
- beq.s .B
- .C move.l a2,a1
- bra ErrorExit
- .B move.l parm3(a5),d1
- beq too_less_args
- move.l d1,d2
- tst.l d3
- bne.s .D
- moveq #-2,d2
- jsr _LVOLock(a6)
- move.l d0,d7
- beq DOSerr
- move.l d0,d2
- .D move.l parm2(a5),d1
- beq too_less_args
- jsr _LVOMakeLink(a6)
- tst.l d0
- beq DOSerrUL
- move.l d7,d1
- beq.s .A
- jsr _LVOUnLock(a6)
- .A moveq #RETURN_OK,d0
- rts
-
- *************************
- * Flags * V2.3
- *************************
- flagsz lea parm2(a5),a3
- move.l Flags(a5),d3
- .A move.l (a3)+,d0
- beq.s .F
- move.l d0,a0
- lea flagsuse+7(pc),a1
- moveq #0,d2
- .B bsr CheckOpt look for flag
- beq.s .D
- addq.w #1,d2
- cmp.w #MaxFlags,d2
- bne.s .B
- lea flagsuse(pc),a1
- bsr pr_stringlf
- bra.s .C
- .D move.l (a3)+,a0 change flag
- bclr d2,d3
- bsr CheckOnOff
- beq.s .A
- bset d2,d3
- bra.s .A
-
- .F moveq #0,d2 print all flags
- lea flagsuse+7(pc),a3
- .E lea temp2buf(a5),a2
- .G move.b (a3)+,d0
- move.b d0,(a2)+
- beq.s .H
- cmp.b #",",d0
- bne.s .G
- .H subq.l #1,a2
- lea flagsoff(pc),a1
- btst d2,d3
- beq.s .I
- lea flagson(pc),a1
- .I bsr addstring
- lea temp2buf(a5),a1
- bsr pr_string
- addq.w #1,d2
- cmp.w #MaxFlags,d2
- bne.s .E
- move.l d3,Flags(a5)
- .C moveq #RETURN_OK,d0
- rts
-
- *************************
- * MakeIcon * V2.3
- *************************
- makeiconz
- bsr CheckKS
- move.l parm2(a5),d3
- beq too_less_args
- move.l parm3(a5),d0
- beq.s .E
- move.l d0,a0
- moveq #1,d2
- lea iconuse+7(pc),a1
- .D bsr CheckOpt
- beq.s .C
- addq.l #1,d2
- cmp.b #9,d2
- bne.s .D
- .B move.l dosbase(a5),a6
- lea iconuse(pc),a1
- bsr pr_stringlf
- bra.s .A
- .C bsr OpenIconLib
- beq.s .B
- move.l d2,d0
- jsr _LVOGetDefDiskObject(a6)
- move.l d0,d2
- beq resi_not_found
- move.l d0,a1
- move.l d3,a0
- jsr _LVOPutDiskObject(a6)
- move.l d0,d3
- move.l d2,a0
- jsr _LVOFreeDiskObject(a6)
- tst.l d3
- beq resi_not_found
- .A move.l dosbase(a5),a6
- moveq #RETURN_OK,d0
- rts
-
- .E ;shows icon using wb.lib's wbinfo
- cmp.w #39,kickver(a5) needs OS3.0+
- blo.s .B
- bsr OpenWBLib
- beq.s .B
- move.l thistask(a5),a0
- move.l pr_CurrentDir(a0),a0
- move.l parm2(a5),a1
- move.l iconbase(a5),a2
- move.l $38(a2),a2
- jsr _LVOWBInfo(a6)
- bra.s .A
-
-
- recol1 dc.w residetx+3-start,assign_tx+4-start,volume_tx+3-start
- dc.w device_tx+4-start,breaktx+4-start,locktext+13-start
- dc.w show_tx+2-start,show2_tx+2-start,shta_tx+2-start
- dc.w proform+4-start,inform_tx+2-start,inform+24-start
- dc.w inform2+15-start,stat_text+3-start,totsize+3-start
- dc.w dirof+3-start,farb2+3-start,farb3+3-start
- dc.w doserrtx+2-start,helpmor+3-start
- recol2 ;Recolour-table to switch globally to one colour
- dc.b 2,2,2,2,6,3,2,2,2,3,2,7,5,7,7,6,2,3,6,2
-
-
- doserror_text
- dc.b 103,'No free Store',0
- dc.b 121,'File not Object',0
- dc.b 202,'Object in use',0
- dc.b 203,'Object exists',0
- dc.b 204,'Dir not found',0
- dc.b 205,'Object not found',0
- dc.b 209,'Action unknown',0
- dc.b 210,'Invalid Name',0
- dc.b 212,'Object wrong Type',0
- dc.b 213,'Not validated',0
- dc.b 214,'Disk write-protected',0
- dc.b 215,'Rename across Devices',0
- dc.b 216,'Dir not empty',0
- dc.b 218,'Device not mounted',0
- dc.b 221,'Disk full',0
- dc.b 222,'Delete protected',0
- dc.b 223,'Write protected',0
- dc.b 224,'Read protected',0
- nodos dc.b 225,'Not a DOS Disk',0
- nodisk dc.b 226,'No Disk present',0
- dc.b 49,'Not executable',0 305
- dc.b 0
-
- ZShellName dc.b 'ZShell',0
- dosname dc.b 'dos.library',0
- intuiname dc.b 'intuition.library',0
- iconname dc.b 'icon.library',0
- wbname dc.b 'workbench.library',0
- timdev dc.b 'timer.device',0
- conname dc.b 'CON:0/10/640/190/ZShell V2.4/CLOSE',0
- connil dc.b 'NIL:',0
- wintool dc.b 'WINDOW',0
- scripttool dc.b 'SCRIPT',0
- norawtool dc.b 'NORAW',0
- commandtool dc.b 'COMMAND',0
- iconifytool dc.b 'ICONIFY',0
- xpostool dc.b 'XPOS',0
- ypostool dc.b 'YPOS',0
- nametool dc.b 'ICONNAME',0
- welcome dc.b "Welcome to ZShell Process %ld !",10,0
- useit dc.b "Usage: ZShell [-R] [-Wwindow] [-Sscript]"
- dc.b " [-Ccommand] [-N] [-D]",0
- onoffuse dc.b "ON or OFF ?",0
- flagsuse dc.b "Flags: CHECK,MATCH,ICON,WILD,ERRORS"
- dc.b ",DEBUG,CUT,ALL,HIDE",0
- iconuse dc.b "Types: DISK,DRAWER,TOOL,PROJECT,GARBAGE"
- dc.b ",DEVICE,KICK,APPICON",0
- linkuse dc.b "HARD or SOFT ?",0
- assignuse dc.b "REMOVE,ADD,PATH,DEFER ?",0
- devicetx dc.b "DEVICE",0
- forcetx dc.b "FORCE",0
- alltx dc.b "ALL",0
- runit dc.b ';ask Press RETURN;endcli',0
- runnil dc.b '-w',0
- less_args_tx dc.b 'Not enough arguments',0
- bad_number_tx dc.b 'Bad number',0
- oldkick_tx dc.b 'Needs Kickstart 2.0+',0
- clktask dc.b 'MemClock',0
- clkform dc.b ' Mem:%7ld Chip:%6ld %02d:%02d:%02d ',0
- goto_error_tx dc.b 'GOTO statement error',10,0
- if_error_tx dc.b 'IF statement error',10,0
- warn_tx dc.b 'warn',0
- error_tx dc.b 'error',0
- fail_tx dc.b 'fail',0
- not_tx dc.b 'not',0
- exists_tx dc.b 'exists',0
- view1_tx dc.b ' Bytes',10,0
- badprotbit dc.b 'Unknown protection bit',0
- residetx dc.b 27,'[32mUsecount Adress Name',27,'[m',0
- rpn_result_tx dc.b 'RESULT: Dec %ld Hex $%08lx',10,0
- rpn_res2 dc.b '%ld',0
- failat_tx dc.b 'Failat: %ld',10,0
- defscript dc.b 'S:ZStart',0 ;changed V2.0
- rexxtx dc.b 'REXX:RX',0
- unmounted_tx dc.b '[UnMounted]',10,0
- mounted_tx dc.b '[Mounted]',0
- assign_tx dc.b 10,27,'[32mAssigns:',27,'[m',10,0
- volume_tx dc.b 27,'[32mVolumes:',27,'[m',10,0
- device_tx dc.b 10,27,'[32mDevices:',27,'[m',10,0
- bad_unset_tx dc.b ' could not be unset!',10,0
- breaktx dc.b 10,27,'[36m*** BREAK ***',27,'[m',10,0
- prompt_args_tx dc.b 4,'%s> ',0
- stk_too_small_tx dc.b 'Too Small',10,0
- stk_size_tx dc.b 'Stack: %ld bytes',10,0
- stack_tx dc.b 'Stack overflow',0
- lockntx dc.b 'Give LOCK-BPTR or NAME',0
- lockread dc.b 'READ',0
- lockwrite dc.b 'WRITE',0
- locktext dc.b '%s-Lock on ',$9b,'33m%s',$9b,'m'
- dc.b 10,'This Lock: $%06lx Next: $%06lx',10,0
- clk_tx dc.b 'LOAD or SAVE ?',0
- noclk_tx dc.b 'No Clock found',0
- muell_tx dc.b 'Format: DD.MM.YY or MM-DD-YY or HH:MM:SS',0
- styp dc.b 'lrdimps'
- shuse_tx dc.b 'Use D,I,L,M,P,R,S,T or V',0
- show_tx dc.b $9b,'32mAdress Pri Name',$9b,'m',0
- show2_tx dc.b $9b,'32mAdress Pri Ver Rev Name',$9b,'m',0
- shform dc.b '%06lx%4d %s',10,0
- shform2 dc.b '%06lx%4d%4d%4d %s',10,0
- shta_tx dc.b $9b,'32mAdress Pri State SignWait PT '
- dc.b 'Name',$9b,'m',0
- shtaform dc.b '%06lx%4d %-5s %08lx %c%c %s',0
- proform dc.b 32,9,$9b,'33m->%sCLI %ld:',$9b,'m %s %s%s',0
- backcli dc.b "Bg-",0
- ttyp dc.b "Inval",0,"Added",0,"Run",0,"Ready",0
- dc.b "Wait",0,"Exept",0,"Remov",0
- inform_tx dc.b $9b,'32mName Unit Sys Size Free Full Block'
- dc.b ' Status Err Volume',$9b,'m',0
- inform dc.b '%-7s%2ld %3s%7ldK%7ldK',$9b,'37m%4ld%%',$9b
- dc.b 'm%6ld %-10s%3ld %s',10,0
- inform2 dc.b '%-7s%2ld ',$9b,'35m%s',$9b,'m',10,0
- statro dc.b "Read only",0
- statrw dc.b "Read/Write",0
- statval dc.b "Validating",0
- statun dc.b "Unknown",0
- baddisk dc.b "Unreadable Disk",0
- kickdisk dc.b "Kickstart",0
- inhidisk dc.b "Not Validated",0
- ofs_tx dc.b "OFS",0 OldFilesystem
- dc.b "FFS",0 FastFilesystem
- dc.b "OIN",0 International OFS
- dc.b "FIN",0 International FFS
- dc.b "ODC",0 Dir Cache OFS
- dc.b "FDC",0 Dir Cache FFS
- msd_tx dc.b "MSD",0 MessyDOS
- quest_tx dc.b "???",0 Unknown
- OK_text dc.b "OK.",10,0
- notasktx dc.b "Task not found",0
- noporttx dc.b "Port not found",0
- msendtx dc.b "send",0
- pra5tx dc.b "A5=%06lx",10,0
- msgtx dc.b "Message=%06lx Length=%d",10,0
- time_text dc.b "Date: %02d.%02d.%02d "
- dc.b "Time: %02d:%02d:%02d.%02d",10,0
- stat_text dc.b 27,"[37mResult2=%ld Time=%02d:%02d:%02d.%02d"
- dc.b " Changes-> Chip:%ld Fast:%ld Total:%ld"
- dc.b 27,"[m",10,0
- lockleft dc.b "Locks: %ld -> %ld",10,0
- lowmemtx dc.b "Changed %06lx: %08lx -> %08lx",10,0
- failertx dc.b 27,"[1mFail-Level: %ld",27,"[m",10,0
- replytx dc.b "Reply? ",0
- mem_line dc.b "%08lx: %08lx %08lx %08lx %08lx '%s'",10,0
- vec_line dc.b "WarmCapture $%06lx",10,"CoolCapture $%06lx",10
- dc.b "ColdCapture $%06lx",10,"KickTagPtr $%06lx",10
- dc.b "KickMemPtr $%06lx",10,"KickCheckSum $%06lx",10,0
- formatask dc.b "Delete whole disk ? ",0
- addbufftx dc.b "%s has %ld buffers",10,0
- pfeil dc.b "-> ",0
- flagsoff dc.b ": OFF",10,0
- flagson dc.b ": ON",10,0
- appicontx dc.b "Shell-It !",0
- Forbidtx dc.b "Forbid,Disable!",0
- wbenchtx dc.b "Workbench",0
-
- format dc.b '%8ld',0 ;print a longw right justified
- formatADR dc.b '$%06lx',0 ;print address
- totsize dc.b 27,'[37mTotal Bytes: %ld Blocks: %ld '
- dc.b 'Files: %ld Dirs: %ld',27,'[m',10,0
- dirtext dc.b '(Dir)',27,'[m',0
- cderrtx dc.b 'Where ?',10,0
- dirof dc.b 27,'[36mDirectory of -> ',27,'[m',0
- pcurrent dc.b "Current Dir",0
- pathc dc.b "C:",0
- paths dc.b "S:",0
- helpload dc.b "Loading ZShell.doc ...",10,0
- msearch dc.b 12,$9b,'BSearch: ',$9b," p",0
- mjump dc.b 12,$9b,'BJump to %: ',$9b," p",0
- mwrite dc.b 12,$9b,'BWrite to: ',$9b," p",0
- prtdev dc.b 'PRT:',0
- prtit dc.b 12,$9b,'BPrinting',0
- badcomm dc.b 'Command not found',10,0
- wrongsize dc.b 'New size:',0
- makedirOK dc.b 'created',10,0
- copyOK dc.b 'copied',10,0
- moveOK dc.b 'moved',10,0
- joinOK dc.b 'processed',10,0
- deleteOK dc.b 'deleted',10,0
- yesnotx dc.b 'Yes/No/All/Quit ? ',0
- memess dc.b "Chip: %ld Fast: %ld Total Free: %ld",10,0
-
- star dc.b "*",0
- dot dc.b ".",0
- smaller dc.b "<",0
- bigger dc.b ">",0
- farb1 dc.b 27,'[m',0
- farb2 dc.b 27,'[32m',0
- farb3 dc.b 27,'[33m',0
- lf dc.b 10,0
- tab dc.b 9,0
- backspace_it dc.b 8 DON'T SEPERATE
- delete_it dc.b $9b,'P',0 THESE LINES
- return_it dc.b 13,10,0
- right_cursor dc.b $9b,'C',0
- left_cursor dc.b $9b,'D',0
- delete_line dc.b 13,$9b,'M',0
- backslash dc.b '/',0
- help_ret dc.b 'help^M',0
- clstx dc.b 27,"c",0 reset console
- clrtx dc.b 12,0 clear screen
- scroll_up_tx dc.b $9b,"S",13,0
- scroll_down_tx dc.b $9b,"M",$9b,"T",$9b,"1H",0
- clrhide dc.b 12
- hide_cursor dc.b $9b,"0 p",0
- show_cursor dc.b $9b," p",0
- askforsize dc.b $9b," q",0
- cutontx dc.b $9b,"?7l",0
- cutofftx dc.b $9b,"?7h",0
- ctrl_tx dc.b 'Actual CTRL-Codes: ',0
- ctrl_init dc.b 23,17,19,5,9,24,27,20,25,8,10,13,12,18,22,46 CTRL-Codes
- ctrl_inite
- doserrtx dc.b $9b,'36mERROR:',$9b,'m' ;DON'T SEPERATE
- space dc.b ' '
- null dc.b 0 ;THESE 3 LINES
-
- helpmor dc.b 13,$9b,"32m %d%% %ld bytes. Use: (shift+)cursor,"
- dc.b "(back)space,numeric,s,j,w,r,h",$9b,"K",$9b,"m",0
- helpman dc.b "ZShell.Doc",0
- helptx1 dc.b '$VER: ZShell V2.4 (26.02.95)',10
- dc.b "(C)1990,91 Paul Hayter (V1.3); "
- dc.b "Updated 1993-95 by Martin Gierich.",10
- dc.b "Freeware, NO commercial usage !",10
- dc.b "Please send your comments to"
- dc.b " uj3w@rz.uni-karlsruhe.de",10,10
- dc.b "Commands:",0
- helptx2 dc.b 10,"Options:",10
- dc.b "-r/-RECURSIVE: copy,ctrl,delete,dir,join,list,move,protect,",10
- dc.b "-c/-CLEAR: avail,ctrl,endcli,locate,path,resident,run",10
- dc.b "-q/-QUICK: dir,join,list,delete",10
- dc.b "-s/-SORT: copy,move,protect",10
- dc.b 10,"Wildcards: * ? ~ [] |",10
- dc.b "Editing: (SHIFT+) Cursor, <-, DEL,"
- dc.b " (SHIFT+) TAB, ESC and see ctrl",10
- dc.b ". for dir back, force disk or abbreviation",10
- dc.b "Type 'help ?' for more help.",0
- helptx3
-
- *********************************************
-
- comtext dc.b 'addbuffers',0 V1.27
- dc.b 'alias',0
- dc.b 'ask',0 V1.28
- dc.b 'assign',0
- dc.b 'avail',0
- dc.b 'border',0 V2.0
- dc.b 'break',0 V2.0
- dc.b 'cd',0
- dc.b 'cls',0 V2.0
- dc.b 'copy',0
- dc.b 'ctrl',0 V2.0
- dc.b 'date',0
- dc.b 'diskchange',0 V2.0
- dc.b 'delete',0
- dc.b 'die',0 V2.0
- dc.b 'dir',0
- dc.b 'echo',0
- else_tx dc.b 'else',0 V1.28
- dc.b 'endcli',0
- endif_tx dc.b 'endif',0 V1.28
- dc.b 'eval',0
- dc.b 'execute',0
- dc.b 'failat',0
- dc.b 'fault',0 V2.0
- dc.b 'filenote',0 V2.0
- dc.b 'flags',0 V2.3
- dc.b 'getmsg',0 V2.0
- dc.b 'help',0
- dc.b 'htype',0 V1.29
- dc.b 'if',0 V1.28
- dc.b 'info',0
- dc.b 'join',0 V1.29
- label_tx dc.b 'lab',0 V1.29
- dc.b 'list',0
- dc.b 'locate',0 V2.0
- dc.b 'lock',0 V2.0
- dc.b 'm',0
- dc.b 'makedir',0
- dc.b 'makeicon',0 V2.3
- dc.b 'makelink',0 V2.3
- dc.b 'memclk',0 V2.0
- dc.b 'more',0 V1.23
- dc.b 'move',0 V2.3
- dc.b 'newcli',0 V2.0
- dc.b 'path',0
- dc.b 'prompt',0
- dc.b 'protect',0
- dc.b 'putmsg',0 V2.0
- dc.b 'quit',0 V1.29
- dc.b 'relabel',0 V1.27
- dc.b 'rename',0
- dc.b 'resident',0 V1.25
- dc.b 'review',0 V2.1
- dc.b 'run',0 V2.2
- dc.b 'search',0 V2.0
- dc.b 'setclock',0 V2.0
- dc.b 'setdate',0 V2.0
- dc.b 'show',0 V2.0
- dc.b 'skip',0
- dc.b 'stack',0
- dc.b 'strings',0 V1.29
- dc.b 'taskpri',0 V2.0
- dc.b 'type',0
- dc.b 'unalias',0
- dc.b 'wait',0
- dc.b 0
-
-
- cnop 0,2
- comoffs
- dc.w addbuffersz-start
- dc.w set_funcz-start ;alias
- dc.w askz-start
- dc.w assignz-start
- dc.w availz-start
- dc.w borderz-start
- dc.w breakz-start
- dc.w cdz-start
- dc.w clsz-start
- dc.w copyz-start
- dc.w ctrlz-start
- dc.w datez-start
- dc.w diskchangez-start
- dc.w deletez-start
- dc.w diez-start
- dc.w dirz-start
- dc.w echoz-start
- dc.w elsez-start
- dc.w endcliz-start
- dc.w endifz-start
- dc.w evalz-start
- dc.w executez-start
- dc.w failatz-start
- dc.w faultz-start
- dc.w filenotez-start
- dc.w flagsz-start
- dc.w getmsgz-start
- dc.w helpz-start
- dc.w htypez-start
- dc.w ifz-start
- dc.w infoz-start
- dc.w joinz-start
- dc.w labelz-start ;lab
- dc.w listz-start
- dc.w locatez-start
- dc.w lockz-start
- dc.w memexamz-start ;m
- dc.w makedirz-start
- dc.w makeiconz-start
- dc.w makelinkz-start
- dc.w memclkz-start
- dc.w morez-start
- dc.w movez-start
- dc.w newcliz-start
- dc.w pathz-start
- dc.w promptz-start
- dc.w protectz-start
- dc.w putmsgz-start
- dc.w quitz-start
- dc.w relabelz-start
- dc.w renamez-start
- dc.w residentz-start
- dc.w reviewz-start
- dc.w runz-start
- dc.w searchz-start
- dc.w setclockz-start
- dc.w setdatez-start
- dc.w showz-start
- dc.w skipz-start
- dc.w stackz-start
- dc.w stringsz-start
- dc.w taskpriz-start
- dc.w typez-start
- dc.w unsetz-start ;unalias
- dc.w waitz-start
-
- manadr dc.l 0 here are 2 global variables
- mansize dc.l 0 because the online-help-manual is used globally
-
- end ;*** here it ends ***
-
-